	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function i810_dma_dispatch_mc
_i810_dma_dispatch_mc:                  ## @i810_dma_dispatch_mc
	.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
	movl	%ecx, -44(%rbp)                 ## 4-byte Spill
	movl	%edx, %r12d
	movq	(%rdi), %rax
	movq	8(%rdi), %r14
	movq	(%rsi), %r13
	movq	%rsi, -56(%rbp)                 ## 8-byte Spill
	movq	8(%rsi), %rbx
	movq	8(%r14), %rcx
	movq	%rcx, -64(%rbp)                 ## 8-byte Spill
	movq	%r13, %r15
	subq	(%rax), %r15
	callq	_i810_kernel_lost_context
	movq	%rbx, -72(%rbp)                 ## 8-byte Spill
	movl	24(%rbx), %edi
	movq	_I810_BUF_CLIENT@GOTPCREL(%rip), %rbx
	movl	(%rbx), %esi
	movq	_I810_BUF_HARDWARE@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	callq	_cmpxchg
	cmpl	(%rbx), %eax
	je	LBB0_2
## %bb.1:
	leaq	L_.str(%rip), %rdi
	xorl	%eax, %eax
	callq	_DRM_DEBUG
LBB0_2:
	xorl	%eax, %eax
	cmpl	$4097, %r12d                    ## imm = 0x1001
	cmovgel	%eax, %r12d
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	movl	$127, (%rax)
	leaq	L_.str.1(%rip), %rdi
	movq	%r13, %rsi
	movl	%r12d, %edx
	xorl	%eax, %eax
	callq	_DRM_DEBUG
	movq	(%r14), %rsi
	incq	%rsi
	movq	%rsi, (%r14)
	leaq	L_.str.2(%rip), %rdi
	xorl	%eax, %eax
	callq	_DRM_DEBUG
	leaq	L_.str.3(%rip), %rdi
	movq	%r15, %rsi
	xorl	%eax, %eax
	callq	_DRM_DEBUG
	leaq	L_.str.4(%rip), %rdi
	movl	%r12d, %esi
	xorl	%eax, %eax
	callq	_DRM_DEBUG
	movslq	%r12d, %r14
	leaq	(%r14,%r15), %rsi
	addq	$-4, %rsi
	leaq	L_.str.5(%rip), %rdi
	xorl	%eax, %eax
	callq	_DRM_DEBUG
	movq	-72(%rbp), %r13                 ## 8-byte Reload
	movq	(%r13), %rax
	movq	_I810_BUF_MAPPED@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_3
## %bb.4:
	testb	$4, %r12b
	movl	-44(%rbp), %ebx                 ## 4-byte Reload
	je	LBB0_6
## %bb.5:
	movq	16(%r13), %rax
	movq	$0, (%rax,%r14)
	addl	$4, %r12d
LBB0_6:
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	callq	_i810_unmap_buffer
	movl	%ebx, %r14d
	jmp	LBB0_7
LBB0_3:
	movl	-44(%rbp), %r14d                ## 4-byte Reload
LBB0_7:
	movl	$4, %edi
	callq	_BEGIN_LP_RING
	movq	_CMD_OP_BATCH_BUFFER@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_OUT_RING
	movq	_BB1_PROTECTED@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	orl	%r15d, %edi
	callq	_OUT_RING
	leal	(%r15,%r12), %edi
	addl	$-4, %edi
	callq	_OUT_RING
	xorl	%edi, %edi
	callq	_OUT_RING
	xorl	%eax, %eax
	callq	_ADVANCE_LP_RING
	movl	$8, %edi
	callq	_BEGIN_LP_RING
	movq	_CMD_STORE_DWORD_IDX@GOTPCREL(%rip), %rbx
	movl	(%rbx), %edi
	callq	_OUT_RING
	movl	8(%r13), %edi
	callq	_OUT_RING
	movq	_I810_BUF_FREE@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_OUT_RING
	xorl	%edi, %edi
	callq	_OUT_RING
	movl	(%rbx), %edi
	callq	_OUT_RING
	movl	$16, %edi
	callq	_OUT_RING
	movl	%r14d, %edi
	callq	_OUT_RING
	xorl	%edi, %edi
	callq	_OUT_RING
	xorl	%eax, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_ADVANCE_LP_RING                ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_RING_LOCALS,4,2                ## @RING_LOCALS
	.comm	_I810_BUF_CLIENT,4,2            ## @I810_BUF_CLIENT
	.comm	_I810_BUF_HARDWARE,4,2          ## @I810_BUF_HARDWARE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"MC found buffer that isn't mine!\n"

L_.str.1:                               ## @.str.1
	.asciz	"addr 0x%lx, used 0x%x\n"

L_.str.2:                               ## @.str.2
	.asciz	"dispatch counter : %ld\n"

L_.str.3:                               ## @.str.3
	.asciz	"start : %lx\n"

L_.str.4:                               ## @.str.4
	.asciz	"used : %d\n"

L_.str.5:                               ## @.str.5
	.asciz	"start + used - 4 : %ld\n"

	.comm	_I810_BUF_MAPPED,8,3            ## @I810_BUF_MAPPED
	.comm	_CMD_OP_BATCH_BUFFER,4,2        ## @CMD_OP_BATCH_BUFFER
	.comm	_BB1_PROTECTED,8,3              ## @BB1_PROTECTED
	.comm	_CMD_STORE_DWORD_IDX,4,2        ## @CMD_STORE_DWORD_IDX
	.comm	_I810_BUF_FREE,4,2              ## @I810_BUF_FREE
	.no_dead_strip	_i810_dma_dispatch_mc
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function i810_dma_dispatch_mc
_i810_dma_dispatch_mc:                  ; @i810_dma_dispatch_mc
	.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, x3
	mov	x21, x2
	mov	x20, x1
	ldp	x8, x24, [x0]
	ldr	x26, [x24, #8]
	ldp	x25, x22, [x1]
	ldr	x8, [x8]
	sub	x23, x25, x8
	bl	_i810_kernel_lost_context
	ldr	w0, [x22, #24]
Lloh0:
	adrp	x27, _I810_BUF_CLIENT@GOTPAGE
Lloh1:
	ldr	x27, [x27, _I810_BUF_CLIENT@GOTPAGEOFF]
	ldr	w1, [x27]
Lloh2:
	adrp	x8, _I810_BUF_HARDWARE@GOTPAGE
Lloh3:
	ldr	x8, [x8, _I810_BUF_HARDWARE@GOTPAGEOFF]
Lloh4:
	ldr	w2, [x8]
	bl	_cmpxchg
	ldr	w8, [x27]
	cmp	w0, w8
	b.eq	LBB0_2
; %bb.1:
Lloh5:
	adrp	x0, l_.str@PAGE
Lloh6:
	add	x0, x0, l_.str@PAGEOFF
	bl	_DRM_DEBUG
LBB0_2:
	cmp	w21, #1, lsl #12                ; =4096
	csel	w21, wzr, w21, gt
	mov	w8, #127
	str	w8, [x26]
	stp	x25, x21, [sp]
Lloh7:
	adrp	x0, l_.str.1@PAGE
Lloh8:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_DRM_DEBUG
	ldr	x8, [x24]
	add	x8, x8, #1
	str	x8, [x24]
	str	x8, [sp]
Lloh9:
	adrp	x0, l_.str.2@PAGE
Lloh10:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_DRM_DEBUG
	str	x23, [sp]
Lloh11:
	adrp	x0, l_.str.3@PAGE
Lloh12:
	add	x0, x0, l_.str.3@PAGEOFF
	bl	_DRM_DEBUG
	str	x21, [sp]
Lloh13:
	adrp	x0, l_.str.4@PAGE
Lloh14:
	add	x0, x0, l_.str.4@PAGEOFF
	bl	_DRM_DEBUG
	sxtw	x24, w21
	add	x8, x24, x23
	sub	x8, x8, #4
	str	x8, [sp]
Lloh15:
	adrp	x0, l_.str.5@PAGE
Lloh16:
	add	x0, x0, l_.str.5@PAGEOFF
	bl	_DRM_DEBUG
	ldr	x8, [x22]
Lloh17:
	adrp	x9, _I810_BUF_MAPPED@GOTPAGE
Lloh18:
	ldr	x9, [x9, _I810_BUF_MAPPED@GOTPAGEOFF]
Lloh19:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_6
; %bb.3:
	tbz	w21, #2, LBB0_5
; %bb.4:
	ldr	x8, [x22, #16]
	str	xzr, [x8, x24]
	add	w21, w21, #4
LBB0_5:
	mov	x0, x20
	bl	_i810_unmap_buffer
LBB0_6:
	mov	w0, #4
	bl	_BEGIN_LP_RING
Lloh20:
	adrp	x8, _CMD_OP_BATCH_BUFFER@GOTPAGE
Lloh21:
	ldr	x8, [x8, _CMD_OP_BATCH_BUFFER@GOTPAGEOFF]
Lloh22:
	ldr	w0, [x8]
	bl	_OUT_RING
Lloh23:
	adrp	x8, _BB1_PROTECTED@GOTPAGE
Lloh24:
	ldr	x8, [x8, _BB1_PROTECTED@GOTPAGEOFF]
Lloh25:
	ldr	w8, [x8]
	orr	w0, w8, w23
	bl	_OUT_RING
	add	w8, w23, w21
	sub	w0, w8, #4
	bl	_OUT_RING
	mov	w0, #0
	bl	_OUT_RING
	bl	_ADVANCE_LP_RING
	mov	w0, #8
	bl	_BEGIN_LP_RING
Lloh26:
	adrp	x20, _CMD_STORE_DWORD_IDX@GOTPAGE
Lloh27:
	ldr	x20, [x20, _CMD_STORE_DWORD_IDX@GOTPAGEOFF]
	ldr	w0, [x20]
	bl	_OUT_RING
	ldr	w0, [x22, #8]
	bl	_OUT_RING
Lloh28:
	adrp	x8, _I810_BUF_FREE@GOTPAGE
Lloh29:
	ldr	x8, [x8, _I810_BUF_FREE@GOTPAGEOFF]
Lloh30:
	ldr	w0, [x8]
	bl	_OUT_RING
	mov	w0, #0
	bl	_OUT_RING
	ldr	w0, [x20]
	bl	_OUT_RING
	mov	w0, #16
	bl	_OUT_RING
	mov	x0, x19
	bl	_OUT_RING
	mov	w0, #0
	bl	_OUT_RING
	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
	b	_ADVANCE_LP_RING
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpLdrGot	Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.cfi_endproc
                                        ; -- End function
	.comm	_RING_LOCALS,4,2                ; @RING_LOCALS
	.comm	_I810_BUF_CLIENT,4,2            ; @I810_BUF_CLIENT
	.comm	_I810_BUF_HARDWARE,4,2          ; @I810_BUF_HARDWARE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"MC found buffer that isn't mine!\n"

l_.str.1:                               ; @.str.1
	.asciz	"addr 0x%lx, used 0x%x\n"

l_.str.2:                               ; @.str.2
	.asciz	"dispatch counter : %ld\n"

l_.str.3:                               ; @.str.3
	.asciz	"start : %lx\n"

l_.str.4:                               ; @.str.4
	.asciz	"used : %d\n"

l_.str.5:                               ; @.str.5
	.asciz	"start + used - 4 : %ld\n"

	.comm	_I810_BUF_MAPPED,8,3            ; @I810_BUF_MAPPED
	.comm	_CMD_OP_BATCH_BUFFER,4,2        ; @CMD_OP_BATCH_BUFFER
	.comm	_BB1_PROTECTED,8,3              ; @BB1_PROTECTED
	.comm	_CMD_STORE_DWORD_IDX,4,2        ; @CMD_STORE_DWORD_IDX
	.comm	_I810_BUF_FREE,4,2              ; @I810_BUF_FREE
	.no_dead_strip	_i810_dma_dispatch_mc
.subsections_via_symbols
