	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function via_dispatch_cmdbuffer
_via_dispatch_cmdbuffer:                ## @via_dispatch_cmdbuffer
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	(%rdi), %r15
	cmpq	$0, 16(%r15)
	je	LBB0_3
## %bb.1:
	movq	%rsi, %r14
	movl	(%rsi), %edx
	movq	_VIA_PCI_BUF_SIZE@GOTPCREL(%rip), %rax
	cmpl	(%rax), %edx
	jle	LBB0_4
## %bb.2:
	movq	_ENOMEM@GOTPCREL(%rip), %rcx
	jmp	LBB0_6
LBB0_3:
	leaq	L_.str(%rip), %rdi
	callq	_DRM_ERROR
	jmp	LBB0_5
LBB0_4:
	movq	%rdi, %rbx
	movq	8(%r15), %rdi
	movl	4(%r14), %esi
	callq	_copy_from_user
	testq	%rax, %rax
	je	LBB0_8
LBB0_5:
	movq	_EFAULT@GOTPCREL(%rip), %rcx
LBB0_6:
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_7:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_8:
	movq	8(%r15), %rdi
	movl	(%r14), %esi
	movq	%rbx, %rdx
	movl	$1, %ecx
	callq	_via_verify_command_stream
	testl	%eax, %eax
	jne	LBB0_7
## %bb.9:
	movl	(%r14), %eax
	cmpl	$256, %eax                      ## imm = 0x100
	movl	$258, %esi                      ## imm = 0x102
	cmovgel	%eax, %esi
	movq	%r15, %rdi
	callq	_via_check_dma
	testq	%rax, %rax
	je	LBB0_13
## %bb.10:
	movq	8(%r15), %rsi
	movl	(%r14), %edx
	movq	%rax, %rdi
	callq	_memcpy
	movl	(%r14), %eax
	addl	%eax, (%r15)
	cmpl	$255, %eax
	jg	LBB0_12
## %bb.11:
	movl	$256, %esi                      ## imm = 0x100
	subl	%eax, %esi
	shrl	$3, %esi
	movq	%r15, %rdi
	callq	_via_pad_cache
LBB0_12:
	movq	%r15, %rdi
	callq	_via_cmdbuf_pause
	xorl	%eax, %eax
	jmp	LBB0_7
LBB0_13:
	movq	_EAGAIN@GOTPCREL(%rip), %rcx
	jmp	LBB0_6
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"called without initializing AGP ring buffer.\n"

	.comm	_EFAULT,4,2                     ## @EFAULT
	.comm	_VIA_PCI_BUF_SIZE,4,2           ## @VIA_PCI_BUF_SIZE
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_EAGAIN,4,2                     ## @EAGAIN
	.no_dead_strip	_via_dispatch_cmdbuffer
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function via_dispatch_cmdbuffer
_via_dispatch_cmdbuffer:                ; @via_dispatch_cmdbuffer
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	ldr	x19, [x0]
	ldr	x8, [x19, #16]
	cbz	x8, LBB0_3
; %bb.1:
	mov	x20, x1
	ldr	w2, [x1]
Lloh0:
	adrp	x8, _VIA_PCI_BUF_SIZE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _VIA_PCI_BUF_SIZE@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w2, w8
	b.le	LBB0_4
; %bb.2:
Lloh3:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh4:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
	b	LBB0_6
LBB0_3:
Lloh5:
	adrp	x0, l_.str@PAGE
Lloh6:
	add	x0, x0, l_.str@PAGEOFF
	bl	_DRM_ERROR
	b	LBB0_5
LBB0_4:
	mov	x21, x0
	ldr	x0, [x19, #8]
	ldr	w1, [x20, #4]
	bl	_copy_from_user
	cbz	x0, LBB0_8
LBB0_5:
Lloh7:
	adrp	x8, _EFAULT@GOTPAGE
Lloh8:
	ldr	x8, [x8, _EFAULT@GOTPAGEOFF]
LBB0_6:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_7:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
LBB0_8:
	ldr	x0, [x19, #8]
	ldr	w1, [x20]
	mov	x2, x21
	mov	w3, #1
	bl	_via_verify_command_stream
	cbnz	w0, LBB0_7
; %bb.9:
	ldr	w8, [x20]
	mov	w9, #258
	cmp	w8, #256
	csel	w1, w9, w8, lt
	mov	x0, x19
	bl	_via_check_dma
	cbz	x0, LBB0_13
; %bb.10:
	ldr	x1, [x19, #8]
	ldr	w2, [x20]
	bl	_memcpy
	ldr	w8, [x20]
	ldr	w9, [x19]
	add	w9, w9, w8
	str	w9, [x19]
	cmp	w8, #255
	b.gt	LBB0_12
; %bb.11:
	mov	w9, #256
	sub	w8, w9, w8
	lsr	w1, w8, #3
	mov	x0, x19
	bl	_via_pad_cache
LBB0_12:
	mov	x0, x19
	bl	_via_cmdbuf_pause
	mov	w0, #0
	b	LBB0_7
LBB0_13:
Lloh9:
	adrp	x8, _EAGAIN@GOTPAGE
Lloh10:
	ldr	x8, [x8, _EAGAIN@GOTPAGEOFF]
	b	LBB0_6
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh9, Lloh10
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"called without initializing AGP ring buffer.\n"

	.comm	_EFAULT,4,2                     ; @EFAULT
	.comm	_VIA_PCI_BUF_SIZE,4,2           ; @VIA_PCI_BUF_SIZE
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_EAGAIN,4,2                     ; @EAGAIN
	.no_dead_strip	_via_dispatch_cmdbuffer
.subsections_via_symbols
