	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_mei_dma_ring_read              ## -- Begin function mei_dma_ring_read
	.p2align	4, 0x90
_mei_dma_ring_read:                     ## @mei_dma_ring_read
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, %ebx
	movq	%rsi, %r14
	movq	%rdi, %r13
	callq	_mei_dma_ring_ctrl
	movq	%rax, %r15
	xorl	%edi, %edi
	testq	%rax, %rax
	sete	%dil
	callq	_WARN_ON
	testq	%rax, %rax
	je	LBB0_1
LBB0_8:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_1:
	movl	8(%r13), %edi
	leaq	L_.str(%rip), %rsi
	movl	%ebx, %edx
	callq	_dev_dbg
	testl	%ebx, %ebx
	je	LBB0_8
## %bb.2:
	movq	(%r13), %rax
	movq	_DMA_DSCR_DEVICE@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movl	(%rax,%rcx,4), %eax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	movq	(%r15), %rdi
	callq	_READ_ONCE
	movl	%eax, %r12d
	movl	%ebx, %edi
	callq	_mei_data2slots
                                        ## kill: def $eax killed $eax def $rax
	testq	%r14, %r14
	je	LBB0_7
## %bb.3:
	movq	%r14, %rbx
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
	sarl	$2, %esi
	leal	-1(%rsi), %ecx
	andl	%ecx, %r12d
	leal	(%r12,%rax), %ecx
	cmpl	%esi, %ecx
	movq	%r12, %rdx
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	jle	LBB0_4
## %bb.5:
	subl	%edx, %esi
	movq	%r13, %rdi
	movq	%rsi, %r12
	movq	%rbx, %rsi
                                        ## kill: def $edx killed $edx killed $rdx
	movq	%rax, %r14
	movl	%r12d, %ecx
	callq	_mei_dma_copy_from
	cltq
	addq	%rax, %rbx
	movl	%r14d, %ecx
	subl	%r12d, %ecx
	xorl	%edx, %edx
	jmp	LBB0_6
LBB0_4:
	movl	%eax, %ecx
LBB0_6:
	movq	%r13, %rdi
	movq	%rbx, %rsi
                                        ## kill: def $edx killed $edx killed $rdx
	callq	_mei_dma_copy_from
	movq	-48(%rbp), %rax                 ## 8-byte Reload
LBB0_7:
	movq	(%r15), %rdi
	movslq	%eax, %rsi
	addq	%rdi, %rsi
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_WRITE_ONCE                     ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"reading from dma %u bytes\n"

	.comm	_DMA_DSCR_DEVICE,8,3            ## @DMA_DSCR_DEVICE
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_mei_dma_ring_read              ; -- Begin function mei_dma_ring_read
	.p2align	2
_mei_dma_ring_read:                     ; @mei_dma_ring_read
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	mov	x22, x2
	mov	x20, x1
	mov	x21, x0
	bl	_mei_dma_ring_ctrl
	mov	x19, x0
	cmp	x0, #0
	cset	w0, eq
	bl	_WARN_ON
	cbz	x0, LBB0_2
LBB0_1:
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
LBB0_2:
	ldr	w0, [x21, #8]
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x22
	bl	_dev_dbg
	cbz	w22, LBB0_1
; %bb.3:
	ldr	x8, [x21]
Lloh2:
	adrp	x9, _DMA_DSCR_DEVICE@GOTPAGE
Lloh3:
	ldr	x9, [x9, _DMA_DSCR_DEVICE@GOTPAGEOFF]
Lloh4:
	ldr	x9, [x9]
	ldr	w24, [x8, x9, lsl #2]
	ldr	x0, [x19]
	bl	_READ_ONCE
	mov	x23, x0
	mov	x0, x22
	bl	_mei_data2slots
	mov	x22, x0
	cbz	x20, LBB0_8
; %bb.4:
	asr	w8, w24, #2
	sub	w9, w8, #1
	and	w2, w23, w9
	add	w9, w2, w22
	cmp	w9, w8
	b.le	LBB0_6
; %bb.5:
	sub	w23, w8, w2
	mov	x0, x21
	mov	x1, x20
	mov	x3, x23
	bl	_mei_dma_copy_from
	mov	w2, #0
	add	x20, x20, w0, sxtw
	sub	w3, w22, w23
	b	LBB0_7
LBB0_6:
	mov	x3, x22
LBB0_7:
	mov	x0, x21
	mov	x1, x20
	bl	_mei_dma_copy_from
LBB0_8:
	ldr	x0, [x19]
	add	x1, x0, w22, sxtw
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	b	_WRITE_ONCE
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"reading from dma %u bytes\n"

	.comm	_DMA_DSCR_DEVICE,8,3            ; @DMA_DSCR_DEVICE
.subsections_via_symbols
