	.file	"extr_r300_cmdbuf.c_r300_scratch.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	r300_scratch, @function
r300_scratch:
.LFB0:
	.cfi_startproc
	endbr64
	push	r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	push	r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	push	r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	push	r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	push	rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	mov	rbp, rdx
	push	rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movsx	rbp, ebp
	mov	rbx, rsi
	sub	rsp, 72
	.cfi_def_cfa_offset 128
	mov	QWORD PTR [rsp], rdi
	mov	edi, DWORD PTR [rsi]
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR 56[rsp], rax
	xor	eax, eax
	mov	rax, rdx
	sar	rax, 32
	mov	QWORD PTR 16[rsp], rax
	call	drm_buffer_unprocessed@PLT
	lea	rdx, 4[0+rbp*8]
	cdqe
	cmp	rax, rdx
	jb	.L17
	mov	rax, QWORD PTR 16[rsp]
	cmp	eax, 4
	jle	.L19
.L17:
	mov	eax, DWORD PTR EINVAL[rip]
	neg	eax
.L1:
	mov	rcx, QWORD PTR 56[rsp]
	xor	rcx, QWORD PTR fs:40
	jne	.L20
	add	rsp, 72
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	pop	rbx
	.cfi_def_cfa_offset 48
	pop	rbp
	.cfi_def_cfa_offset 40
	pop	r12
	.cfi_def_cfa_offset 32
	pop	r13
	.cfi_def_cfa_offset 24
	pop	r14
	.cfi_def_cfa_offset 16
	pop	r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L19:
	.cfi_restore_state
	movsx	rcx, eax
	sal	rax, 3
	mov	edi, DWORD PTR [rbx]
	lea	rdx, 44[rsp]
	mov	QWORD PTR 24[rsp], rcx
	mov	rcx, QWORD PTR [rsp]
	mov	esi, 4
	mov	QWORD PTR 8[rsp], rax
	add	rax, QWORD PTR [rcx]
	add	QWORD PTR [rax], 1
	call	drm_buffer_read_object@PLT
	mov	rdi, rax
	call	get_unaligned@PLT
	mov	r12, rax
	test	rbp, rbp
	jle	.L5
	xor	r13d, r13d
	lea	r15, 48[rsp]
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L6:
	mov	rax, QWORD PTR [r14]
	mov	edx, 8
	mov	rdi, r15
	lea	rsi, 8[r12+rax*8]
	call	DRM_COPY_FROM_USER@PLT
	test	rax, rax
	jne	.L17
	mov	rax, QWORD PTR 48[rsp]
	test	rax, rax
	je	.L17
	sub	rax, 1
	mov	edx, 8
	mov	rsi, r15
	mov	QWORD PTR 48[rsp], rax
	mov	rax, QWORD PTR [r14]
	lea	rdi, 8[r12+rax*8]
	call	DRM_COPY_TO_USER@PLT
	test	rax, rax
	jne	.L17
	mov	edi, DWORD PTR [rbx]
	mov	esi, 8
	add	r13, 1
	call	drm_buffer_advance@PLT
	cmp	r13, rbp
	je	.L5
.L10:
	mov	edi, DWORD PTR [rbx]
	xor	esi, esi
	call	drm_buffer_pointer_to_dword@PLT
	mov	rsi, QWORD PTR 8[rsp]
	mov	edx, 8
	mov	rdi, QWORD PTR [rax]
	mov	r14, rax
	lea	rax, [rdi+rdi]
	sal	rdi, 4
	mov	QWORD PTR [r14], rax
	mov	rax, QWORD PTR [rsp]
	add	rdi, r12
	add	rsi, QWORD PTR [rax]
	call	DRM_COPY_TO_USER@PLT
	test	rax, rax
	je	.L6
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L5:
	mov	edi, 2
	call	BEGIN_RING@PLT
	mov	edi, DWORD PTR 16[rsp]
	xor	esi, esi
	sal	edi, 2
	movsx	rdi, edi
	add	rdi, QWORD PTR RADEON_SCRATCH_REG0[rip]
	call	CP_PACKET0@PLT
	mov	rdi, rax
	call	OUT_RING@PLT
	mov	rax, QWORD PTR [rsp]
	mov	rcx, QWORD PTR 24[rsp]
	mov	rax, QWORD PTR [rax]
	mov	rdi, QWORD PTR [rax+rcx*8]
	call	OUT_RING@PLT
	xor	eax, eax
	call	ADVANCE_RING@PLT
	xor	eax, eax
	jmp	.L1
.L20:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	r300_scratch, .-r300_scratch
	.comm	RING_LOCALS,4,4
	.comm	RADEON_SCRATCH_REG0,8,8
	.comm	EINVAL,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	 1f - 0f
	.long	 4f - 1f
	.long	 5
0:
	.string	 "GNU"
1:
	.align 8
	.long	 0xc0000002
	.long	 3f - 2f
2:
	.long	 0x3
3:
	.align 8
4:

	.arch armv5t
	.eabi_attribute 20, 1
	.eabi_attribute 21, 1
	.eabi_attribute 23, 3
	.eabi_attribute 24, 1
	.eabi_attribute 25, 1
	.eabi_attribute 26, 2
	.eabi_attribute 30, 2
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"extr_r300_cmdbuf.c_r300_scratch.c"
	.text
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC0:
	.word	__stack_chk_guard
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	r300_scratch, %function
r300_scratch:
	@ args = 0, pretend = 0, frame = 24
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	sub	sp, sp, #28
	mov	r5, r1
	mov	r1, sp
	stm	r1, {r2, r3}
	ldr	r3, .L21
	mov	r8, r0
	ldm	sp, {r9, fp}
	ldr	r0, [r5]
	ldr	r3, [r3]
	str	r3, [sp, #20]
	mov	r3,#0
	bl	drm_buffer_unprocessed
	add	r3, r9, #1
	cmp	r0, r3, lsl #2
	bcc	.L17
	cmp	fp, #4
	ble	.L19
.L17:
	ldr	r3, .L21+4
	ldr	r0, [r3]
	rsb	r0, r0, #0
.L1:
	ldr	r3, .L21
	ldr	r2, [r3]
	ldr	r3, [sp, #20]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L20
	add	sp, sp, #28
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L19:
	ldr	r0, [r8]
	mov	r1, #4
	ldr	r3, [r0, fp, lsl #2]
	add	r2, sp, #16
	add	r3, r3, #1
	str	r3, [r0, fp, lsl #2]
	ldr	r0, [r5]
	bl	drm_buffer_read_object
	bl	get_unaligned
	cmp	r9, #0
	mov	r6, r0
	lsl	r10, fp, #2
	ble	.L5
	mov	r7, #0
	b	.L10
.L6:
	ldr	r1, [r4]
	mov	r2, #4
	add	r1, r1, #1
	add	r1, r6, r1, lsl #2
	add	r0, sp, #12
	bl	DRM_COPY_FROM_USER
	cmp	r0, #0
	bne	.L17
	ldr	r3, [sp, #12]
	cmp	r3, #0
	beq	.L17
	sub	r3, r3, #1
	str	r3, [sp, #12]
	ldr	r0, [r4]
	mov	r2, #4
	add	r0, r0, #1
	add	r0, r6, r0, lsl #2
	add	r1, sp, #12
	bl	DRM_COPY_TO_USER
	cmp	r0, #0
	bne	.L17
	mov	r1, #4
	ldr	r0, [r5]
	add	r7, r7, #1
	bl	drm_buffer_advance
	cmp	r9, r7
	beq	.L5
.L10:
	mov	r1, #0
	ldr	r0, [r5]
	bl	drm_buffer_pointer_to_dword
	mov	r4, r0
	ldr	r0, [r0]
	ldr	r1, [r8]
	lsl	r3, r0, #1
	mov	r2, #4
	str	r3, [r4]
	add	r0, r6, r0, lsl #3
	add	r1, r1, r10
	bl	DRM_COPY_TO_USER
	cmp	r0, #0
	beq	.L6
	b	.L17
.L5:
	mov	r0, #2
	bl	BEGIN_RING
	ldr	r3, .L21+8
	mov	r1, #0
	ldr	r0, [r3]
	add	r0, r10, r0
	bl	CP_PACKET0
	bl	OUT_RING
	ldr	r3, [r8]
	ldr	r0, [r3, fp, lsl #2]
	bl	OUT_RING
	bl	ADVANCE_RING
	mov	r0, #0
	b	.L1
.L20:
	bl	__stack_chk_fail
.L22:
	.align	2
.L21:
	.word	.LC0
	.word	EINVAL
	.word	RADEON_SCRATCH_REG0
	.size	r300_scratch, .-r300_scratch
	.comm	RING_LOCALS,4,4
	.comm	RADEON_SCRATCH_REG0,4,4
	.comm	EINVAL,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
