	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function dw_mci_prepare_desc64
_dw_mci_prepare_desc64:                 ## @dw_mci_prepare_desc64
	.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, -80(%rbp)                 ## 8-byte Spill
	movq	%rdi, -64(%rbp)                 ## 8-byte Spill
	movq	(%rdi), %rax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	testl	%edx, %edx
	je	LBB0_8
## %bb.1:
	movl	%edx, %eax
	movq	%rax, -72(%rbp)                 ## 8-byte Spill
	xorl	%r15d, %r15d
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movq	%rax, %r12
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	jmp	LBB0_2
	.p2align	4, 0x90
LBB0_7:                                 ##   in Loop: Header=BB0_2 Depth=1
	incq	%r15
	cmpq	-72(%rbp), %r15                 ## 8-byte Folded Reload
	je	LBB0_8
LBB0_2:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_4 Depth 2
	leaq	(,%r15,4), %r14
	movq	-80(%rbp), %r13                 ## 8-byte Reload
	movq	(%r13), %rdi
	addq	%r14, %rdi
	callq	_sg_dma_len
	movl	%eax, %ebx
	addq	(%r13), %r14
	movq	%r14, %rdi
	callq	_sg_dma_address
	testl	%ebx, %ebx
	je	LBB0_7
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	%eax, %r13d
	.p2align	4, 0x90
LBB0_4:                                 ##   Parent Loop BB0_2 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movq	_DW_MCI_DESC_DATA_LENGTH@GOTPCREL(%rip), %rax
	movl	(%rax), %r14d
	movq	_USEC_PER_MSEC@GOTPCREL(%rip), %rax
	imull	$100, (%rax), %r8d
	movq	%r12, %rdi
	movl	$1, %edx
	movl	$10, %ecx
	callq	_readl_poll_timeout_atomic
	testq	%rax, %rax
	jne	LBB0_9
## %bb.5:                               ##   in Loop: Header=BB0_4 Depth=2
	cmpl	%r14d, %ebx
	cmovbl	%ebx, %r14d
	movq	_IDMAC_DES0_DIC@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	_IDMAC_DES0_OWN@GOTPCREL(%rip), %rcx
	orl	(%rcx), %eax
	movq	_IDMAC_DES0_CH@GOTPCREL(%rip), %rcx
	orl	(%rcx), %eax
	movl	%eax, (%r12)
	movq	%r12, %rdi
	movl	%r14d, %esi
	callq	_IDMAC_64ADDR_SET_BUFFER1_SIZE
	movl	%r13d, 4(%r12)
	leal	(%r14,%r13), %ecx
	leaq	12(%r12), %rax
	movl	%ecx, %r13d
	movq	%rax, %r12
	subl	%r14d, %ebx
	jne	LBB0_4
## %bb.6:                               ##   in Loop: Header=BB0_2 Depth=1
	leaq	-12(%rax), %rcx
	movq	%rcx, -48(%rbp)                 ## 8-byte Spill
	movq	%rax, %r12
	jmp	LBB0_7
LBB0_9:
	movq	-64(%rbp), %r14                 ## 8-byte Reload
	movl	8(%r14), %edi
	leaq	L_.str(%rip), %rsi
	callq	_dev_dbg
	movq	(%r14), %rdi
	movq	_DESC_RING_BUF_SZ@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	xorl	%ebx, %ebx
	xorl	%esi, %esi
	callq	_memset
	movq	%r14, %rdi
	callq	_dw_mci_idmac_init
	movq	_EINVAL@GOTPCREL(%rip), %rax
	subl	(%rax), %ebx
	jmp	LBB0_10
LBB0_8:
	movq	_IDMAC_DES0_FD@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	-56(%rbp), %rcx                 ## 8-byte Reload
	orl	%eax, (%rcx)
	movq	_IDMAC_DES0_CH@GOTPCREL(%rip), %rax
	movq	_IDMAC_DES0_DIC@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	orl	(%rax), %ecx
	notl	%ecx
	movq	-48(%rbp), %rdx                 ## 8-byte Reload
	andl	(%rdx), %ecx
	movl	%ecx, (%rdx)
	movq	_IDMAC_DES0_LD@GOTPCREL(%rip), %rax
	orl	(%rax), %ecx
	movl	%ecx, (%rdx)
	xorl	%ebx, %ebx
LBB0_10:
	movl	%ebx, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_DW_MCI_DESC_DATA_LENGTH,4,2    ## @DW_MCI_DESC_DATA_LENGTH
	.comm	_IDMAC_DES0_OWN,4,2             ## @IDMAC_DES0_OWN
	.comm	_USEC_PER_MSEC,4,2              ## @USEC_PER_MSEC
	.comm	_IDMAC_DES0_DIC,4,2             ## @IDMAC_DES0_DIC
	.comm	_IDMAC_DES0_CH,4,2              ## @IDMAC_DES0_CH
	.comm	_IDMAC_DES0_FD,4,2              ## @IDMAC_DES0_FD
	.comm	_IDMAC_DES0_LD,4,2              ## @IDMAC_DES0_LD
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"descriptor is still owned by IDMAC.\n"

	.comm	_DESC_RING_BUF_SZ,4,2           ## @DESC_RING_BUF_SZ
	.comm	_EINVAL,4,2                     ## @EINVAL
	.no_dead_strip	_dw_mci_prepare_desc64
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function dw_mci_prepare_desc64
_dw_mci_prepare_desc64:                 ; @dw_mci_prepare_desc64
	.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
	str	x1, [sp, #40]                   ; 8-byte Folded Spill
	str	x0, [sp, #8]                    ; 8-byte Folded Spill
	ldr	x24, [x0]
Lloh0:
	adrp	x27, _IDMAC_DES0_DIC@GOTPAGE
Lloh1:
	ldr	x27, [x27, _IDMAC_DES0_DIC@GOTPAGEOFF]
	stp	x24, x24, [sp, #24]             ; 16-byte Folded Spill
	cbz	w2, LBB0_9
; %bb.1:
	mov	x28, #0
Lloh2:
	adrp	x19, _DW_MCI_DESC_DATA_LENGTH@GOTPAGE
Lloh3:
	ldr	x19, [x19, _DW_MCI_DESC_DATA_LENGTH@GOTPAGEOFF]
Lloh4:
	adrp	x25, _USEC_PER_MSEC@GOTPAGE
Lloh5:
	ldr	x25, [x25, _USEC_PER_MSEC@GOTPAGEOFF]
	mov	w20, #100
Lloh6:
	adrp	x26, _IDMAC_DES0_OWN@GOTPAGE
Lloh7:
	ldr	x26, [x26, _IDMAC_DES0_OWN@GOTPAGEOFF]
	ldr	x24, [sp, #24]                  ; 8-byte Folded Reload
	mov	x21, x24
	str	x24, [sp, #32]                  ; 8-byte Folded Spill
	mov	w8, w2
	str	x8, [sp, #16]                   ; 8-byte Folded Spill
	b	LBB0_3
LBB0_2:                                 ;   in Loop: Header=BB0_3 Depth=1
	add	x28, x28, #1
	ldr	x8, [sp, #16]                   ; 8-byte Folded Reload
	cmp	x28, x8
	b.eq	LBB0_9
LBB0_3:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_5 Depth 2
	ldr	x24, [sp, #40]                  ; 8-byte Folded Reload
	ldr	x8, [x24]
	lsl	x23, x28, #2
	add	x0, x8, x23
	bl	_sg_dma_len
	mov	x22, x0
	ldr	x8, [x24]
	add	x0, x8, x23
	bl	_sg_dma_address
	cbz	w22, LBB0_2
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	mov	x23, x0
LBB0_5:                                 ;   Parent Loop BB0_3 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	w24, [x19]
	ldr	w8, [x25]
	mul	w4, w8, w20
	mov	x0, x21
	mov	w2, #1
	mov	w3, #10
	bl	_readl_poll_timeout_atomic
	cbnz	x0, LBB0_8
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=2
	cmp	w22, w24
	csel	w24, w22, w24, lo
	sub	w22, w22, w24
	ldr	w8, [x26]
	ldr	w9, [x27]
	orr	w8, w9, w8
Lloh8:
	adrp	x9, _IDMAC_DES0_CH@GOTPAGE
Lloh9:
	ldr	x9, [x9, _IDMAC_DES0_CH@GOTPAGEOFF]
Lloh10:
	ldr	w9, [x9]
	orr	w8, w8, w9
	str	w8, [x21]
	mov	x0, x21
	mov	x1, x24
	bl	_IDMAC_64ADDR_SET_BUFFER1_SIZE
	str	w23, [x21, #4]
	add	w23, w24, w23
	add	x21, x21, #12
	cbnz	w22, LBB0_5
; %bb.7:                                ;   in Loop: Header=BB0_3 Depth=1
	sub	x8, x21, #12
	str	x8, [sp, #32]                   ; 8-byte Folded Spill
	b	LBB0_2
LBB0_8:
	ldr	x19, [sp, #8]                   ; 8-byte Folded Reload
	ldr	w0, [x19, #8]
Lloh11:
	adrp	x1, l_.str@PAGE
Lloh12:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_dbg
	ldr	x0, [x19]
Lloh13:
	adrp	x8, _DESC_RING_BUF_SZ@GOTPAGE
Lloh14:
	ldr	x8, [x8, _DESC_RING_BUF_SZ@GOTPAGEOFF]
Lloh15:
	ldr	w2, [x8]
	mov	w1, #0
	bl	_memset
	mov	x0, x19
	bl	_dw_mci_idmac_init
Lloh16:
	adrp	x8, _EINVAL@GOTPAGE
Lloh17:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh18:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_10
LBB0_9:
	mov	w0, #0
Lloh19:
	adrp	x8, _IDMAC_DES0_FD@GOTPAGE
Lloh20:
	ldr	x8, [x8, _IDMAC_DES0_FD@GOTPAGEOFF]
Lloh21:
	ldr	w8, [x8]
	ldr	x10, [sp, #24]                  ; 8-byte Folded Reload
	ldr	w9, [x10]
	orr	w8, w9, w8
	str	w8, [x10]
Lloh22:
	adrp	x8, _IDMAC_DES0_CH@GOTPAGE
Lloh23:
	ldr	x8, [x8, _IDMAC_DES0_CH@GOTPAGEOFF]
Lloh24:
	ldr	w8, [x8]
	ldr	w9, [x27]
	orr	w8, w9, w8
	ldr	x10, [sp, #32]                  ; 8-byte Folded Reload
	ldr	w9, [x10]
	bic	w8, w9, w8
	str	w8, [x10]
Lloh25:
	adrp	x9, _IDMAC_DES0_LD@GOTPAGE
Lloh26:
	ldr	x9, [x9, _IDMAC_DES0_LD@GOTPAGEOFF]
Lloh27:
	ldr	w9, [x9]
	orr	w8, w9, w8
	str	w8, [x10]
LBB0_10:
	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
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.cfi_endproc
                                        ; -- End function
	.comm	_DW_MCI_DESC_DATA_LENGTH,4,2    ; @DW_MCI_DESC_DATA_LENGTH
	.comm	_IDMAC_DES0_OWN,4,2             ; @IDMAC_DES0_OWN
	.comm	_USEC_PER_MSEC,4,2              ; @USEC_PER_MSEC
	.comm	_IDMAC_DES0_DIC,4,2             ; @IDMAC_DES0_DIC
	.comm	_IDMAC_DES0_CH,4,2              ; @IDMAC_DES0_CH
	.comm	_IDMAC_DES0_FD,4,2              ; @IDMAC_DES0_FD
	.comm	_IDMAC_DES0_LD,4,2              ; @IDMAC_DES0_LD
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"descriptor is still owned by IDMAC.\n"

	.comm	_DESC_RING_BUF_SZ,4,2           ; @DESC_RING_BUF_SZ
	.comm	_EINVAL,4,2                     ; @EINVAL
	.no_dead_strip	_dw_mci_prepare_desc64
.subsections_via_symbols
