	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function r300_scratch
_r300_scratch:                          ## @r300_scratch
	.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
	movq	%rdx, %r14
	movq	%rsi, %r13
	movq	%rdi, -48(%rbp)                 ## 8-byte Spill
	movl	(%rsi), %edi
	callq	_drm_buffer_unprocessed
	cltq
	movq	%r14, %rbx
	shlq	$32, %rbx
	movq	%rbx, %rcx
	sarq	$29, %rcx
	orq	$4, %rcx
	cmpq	%rax, %rcx
	ja	LBB0_1
## %bb.2:
	movq	%r14, %r12
	shrq	$32, %r12
	cmpl	$5, %r12d
	jl	LBB0_3
LBB0_1:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_11:
	movl	%ebx, %eax
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_3:
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movq	(%rax), %rax
	movq	%r14, %rcx
	sarq	$32, %rcx
	movq	%rcx, -64(%rbp)                 ## 8-byte Spill
	incq	(%rax,%rcx,8)
	movl	(%r13), %edi
	leaq	-84(%rbp), %rdx
	movl	$4, %esi
	callq	_drm_buffer_read_object
	movq	%rax, %rdi
	callq	_get_unaligned
	movq	%rax, -72(%rbp)                 ## 8-byte Spill
	testq	%rbx, %rbx
	jle	LBB0_10
## %bb.4:
	movslq	%r14d, %rax
	cmpq	$2, %rax
	movl	$1, %r15d
	cmovgeq	%rax, %r15
	movq	-72(%rbp), %rax                 ## 8-byte Reload
	leaq	8(%rax), %r14
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	leaq	(,%rax,8), %rax
	movq	%rax, -80(%rbp)                 ## 8-byte Spill
	.p2align	4, 0x90
LBB0_5:                                 ## =>This Inner Loop Header: Depth=1
	movl	(%r13), %edi
	xorl	%esi, %esi
	callq	_drm_buffer_pointer_to_dword
	movq	%rax, %rbx
	movq	(%rax), %rdi
	leaq	(%rdi,%rdi), %rax
	movq	%rax, (%rbx)
	shlq	$4, %rdi
	addq	-72(%rbp), %rdi                 ## 8-byte Folded Reload
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movq	(%rax), %rsi
	addq	-80(%rbp), %rsi                 ## 8-byte Folded Reload
	movl	$8, %edx
	callq	_DRM_COPY_TO_USER
	testq	%rax, %rax
	jne	LBB0_1
## %bb.6:                               ##   in Loop: Header=BB0_5 Depth=1
	movq	(%rbx), %rax
	leaq	(%r14,%rax,8), %rsi
	leaq	-56(%rbp), %rdi
	movl	$8, %edx
	callq	_DRM_COPY_FROM_USER
	testq	%rax, %rax
	jne	LBB0_1
## %bb.7:                               ##   in Loop: Header=BB0_5 Depth=1
	movq	-56(%rbp), %rax
	testq	%rax, %rax
	je	LBB0_1
## %bb.8:                               ##   in Loop: Header=BB0_5 Depth=1
	decq	%rax
	movq	%rax, -56(%rbp)
	movq	(%rbx), %rax
	leaq	(%r14,%rax,8), %rdi
	leaq	-56(%rbp), %rsi
	movl	$8, %edx
	callq	_DRM_COPY_TO_USER
	testq	%rax, %rax
	jne	LBB0_1
## %bb.9:                               ##   in Loop: Header=BB0_5 Depth=1
	movl	(%r13), %edi
	movl	$8, %esi
	callq	_drm_buffer_advance
	decq	%r15
	jne	LBB0_5
LBB0_10:
	movl	$2, %edi
	callq	_BEGIN_RING
	movq	_RADEON_SCRATCH_REG0@GOTPCREL(%rip), %rax
	shll	$2, %r12d
	movslq	%r12d, %rdi
	addq	(%rax), %rdi
	xorl	%ebx, %ebx
	xorl	%esi, %esi
	callq	_CP_PACKET0
	movq	%rax, %rdi
	callq	_OUT_RING
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movq	(%rax), %rax
	movq	-64(%rbp), %rcx                 ## 8-byte Reload
	movq	(%rax,%rcx,8), %rdi
	callq	_OUT_RING
	xorl	%eax, %eax
	callq	_ADVANCE_RING
	jmp	LBB0_11
	.cfi_endproc
                                        ## -- End function
	.comm	_RING_LOCALS,4,2                ## @RING_LOCALS
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_RADEON_SCRATCH_REG0,8,3        ## @RADEON_SCRATCH_REG0
	.no_dead_strip	_r300_scratch
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function r300_scratch
_r300_scratch:                          ; @r300_scratch
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	mov	x22, x2
	mov	x20, x1
	mov	x19, x0
	ldr	w0, [x1]
	bl	_drm_buffer_unprocessed
	sbfiz	x8, x22, #3, #32
	orr	x8, x8, #0x4
	cmp	x8, w0, sxtw
	b.hi	LBB0_2
; %bb.1:
	lsr	x24, x22, #32
	cmp	w24, #5
	b.lt	LBB0_4
LBB0_2:
Lloh0:
	adrp	x8, _EINVAL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_3:
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
LBB0_4:
	lsl	x25, x22, #32
	ldr	x8, [x19]
	asr	x23, x22, #32
	lsl	x9, x23, #3
	ldr	x10, [x8, x9]
	add	x10, x10, #1
	str	x10, [x8, x9]
	ldr	w0, [x20]
	add	x2, sp, #4
	mov	w1, #4
	bl	_drm_buffer_read_object
	bl	_get_unaligned
	cmp	x25, #1
	b.lt	LBB0_11
; %bb.5:
	mov	x21, x0
	sxtw	x8, w22
	cmp	x8, #1
	csinc	x25, x8, xzr, gt
	add	x26, x0, #8
LBB0_6:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w0, [x20]
	mov	w1, #0
	bl	_drm_buffer_pointer_to_dword
	mov	x22, x0
	ldr	x8, [x0]
	lsl	x9, x8, #1
	str	x9, [x0]
	add	x0, x21, x8, lsl #4
	ldr	x8, [x19]
	add	x1, x8, x23, lsl #3
	mov	w2, #8
	bl	_DRM_COPY_TO_USER
	cbnz	x0, LBB0_2
; %bb.7:                                ;   in Loop: Header=BB0_6 Depth=1
	ldr	x8, [x22]
	add	x1, x26, x8, lsl #3
	add	x0, sp, #8
	mov	w2, #8
	bl	_DRM_COPY_FROM_USER
	cbnz	x0, LBB0_2
; %bb.8:                                ;   in Loop: Header=BB0_6 Depth=1
	ldr	x8, [sp, #8]
	cbz	x8, LBB0_2
; %bb.9:                                ;   in Loop: Header=BB0_6 Depth=1
	sub	x8, x8, #1
	str	x8, [sp, #8]
	ldr	x8, [x22]
	add	x0, x26, x8, lsl #3
	add	x1, sp, #8
	mov	w2, #8
	bl	_DRM_COPY_TO_USER
	cbnz	x0, LBB0_2
; %bb.10:                               ;   in Loop: Header=BB0_6 Depth=1
	ldr	w0, [x20]
	mov	w1, #8
	bl	_drm_buffer_advance
	subs	x25, x25, #1
	b.ne	LBB0_6
LBB0_11:
	mov	w0, #2
	bl	_BEGIN_RING
Lloh3:
	adrp	x8, _RADEON_SCRATCH_REG0@GOTPAGE
Lloh4:
	ldr	x8, [x8, _RADEON_SCRATCH_REG0@GOTPAGEOFF]
Lloh5:
	ldr	x8, [x8]
	lsl	w9, w24, #2
	add	x0, x8, w9, sxtw
	mov	w1, #0
	bl	_CP_PACKET0
	bl	_OUT_RING
	ldr	x8, [x19]
	ldr	x0, [x8, x23, lsl #3]
	bl	_OUT_RING
	bl	_ADVANCE_RING
	mov	w0, #0
	b	LBB0_3
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.cfi_endproc
                                        ; -- End function
	.comm	_RING_LOCALS,4,2                ; @RING_LOCALS
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_RADEON_SCRATCH_REG0,8,3        ; @RADEON_SCRATCH_REG0
	.no_dead_strip	_r300_scratch
.subsections_via_symbols
