	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function r300_emit_carefully_checked_packet0
_r300_emit_carefully_checked_packet0:   ## @r300_emit_carefully_checked_packet0
	.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
	movq	%rsi, -64(%rbp)                 ## 8-byte Spill
	movq	%rdi, -72(%rbp)                 ## 8-byte Spill
	movq	%rdx, %rsi
	shrq	$24, %rsi
	andl	$-256, %esi
	orl	%ecx, %esi
	cmpl	$64, %edx
	jbe	LBB0_1
## %bb.7:
	leaq	L_.str(%rip), %rdi
                                        ## kill: def $esi killed $esi killed $rsi
LBB0_8:
                                        ## kill: def $edx killed $edx killed $rdx
LBB0_9:
	callq	_DRM_ERROR
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_13
LBB0_1:
	movq	%rsi, -48(%rbp)                 ## 8-byte Spill
	movq	%rdx, -56(%rbp)                 ## 8-byte Spill
	testl	%edx, %edx
	je	LBB0_12
## %bb.2:
	movq	-48(%rbp), %rdx                 ## 8-byte Reload
	movl	%edx, %eax
	sarl	$2, %eax
	movslq	%eax, %r12
	movl	-56(%rbp), %r13d                ## 4-byte Reload
	shlq	$2, %r12
	xorl	%r14d, %r14d
	movq	_r300_reg_flags@GOTPCREL(%rip), %r15
	movl	%edx, %ebx
	jmp	LBB0_3
	.p2align	4, 0x90
LBB0_11:                                ##   in Loop: Header=BB0_3 Depth=1
	incq	%r14
	addl	$4, %ebx
	cmpq	%r14, %r13
	je	LBB0_12
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	movq	(%r15), %rax
	addq	%r12, %rax
	movl	(%rax,%r14,4), %edx
	cmpl	$128, %edx
	je	LBB0_11
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=1
	cmpl	$129, %edx
	jne	LBB0_10
## %bb.5:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	movl	(%rax), %edi
	movl	%r14d, %esi
	callq	_drm_buffer_pointer_to_dword
	movl	(%rax), %esi
	movq	-72(%rbp), %rdi                 ## 8-byte Reload
	callq	_radeon_check_offset
	testl	%eax, %eax
	jne	LBB0_11
## %bb.6:
	leaq	L_.str.1(%rip), %rdi
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
                                        ## kill: def $esi killed $esi killed $rsi
	movq	-56(%rbp), %rdx                 ## 8-byte Reload
	jmp	LBB0_8
LBB0_12:
	movq	-56(%rbp), %rbx                 ## 8-byte Reload
	leal	1(%rbx), %edi
	callq	_BEGIN_RING
	leal	-1(%rbx), %esi
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
                                        ## kill: def $edi killed $edi killed $rdi
	callq	_CP_PACKET0
	movl	%eax, %edi
	callq	_OUT_RING
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	movl	(%rax), %edi
	movl	%ebx, %esi
	callq	_OUT_RING_DRM_BUFFER
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_ADVANCE_RING
LBB0_13:
	movl	%ebx, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_10:
	leaq	L_.str.2(%rip), %rdi
	movl	%ebx, %esi
	jmp	LBB0_9
	.cfi_endproc
                                        ## -- End function
	.comm	_RING_LOCALS,4,2                ## @RING_LOCALS
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Cannot emit more than 64 values at a time (reg=%04x sz=%d)\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_r300_reg_flags,8,3             ## @r300_reg_flags
L_.str.1:                               ## @.str.1
	.asciz	"Offset failed range check (reg=%04x sz=%d)\n"

L_.str.2:                               ## @.str.2
	.asciz	"Register %04x failed check as flag=%02x\n"

	.no_dead_strip	_r300_emit_carefully_checked_packet0
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function r300_emit_carefully_checked_packet0
_r300_emit_carefully_checked_packet0:   ; @r300_emit_carefully_checked_packet0
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x19, x2
	lsr	x8, x2, #24
	and	w8, w8, #0xffffff00
	orr	w21, w8, w3
	cmp	w19, #64
	b.ls	LBB0_4
; %bb.1:
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
LBB0_2:
	mov	x1, x21
	mov	x2, x19
LBB0_3:
	bl	_DRM_ERROR
Lloh2:
	adrp	x8, _EINVAL@GOTPAGE
Lloh3:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_12
LBB0_4:
	mov	x20, x1
	cbz	w19, LBB0_11
; %bb.5:
	mov	x22, x0
	mov	x23, #0
	asr	w8, w21, #2
	and	x25, x19, #0xffffffff
	sbfiz	x26, x8, #2, #32
Lloh5:
	adrp	x27, _r300_reg_flags@GOTPAGE
Lloh6:
	ldr	x27, [x27, _r300_reg_flags@GOTPAGEOFF]
	mov	x24, x21
	b	LBB0_7
LBB0_6:                                 ;   in Loop: Header=BB0_7 Depth=1
	add	x23, x23, #1
	add	w24, w24, #4
	cmp	x25, x23
	b.eq	LBB0_11
LBB0_7:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x27]
	add	x8, x8, x26
	ldr	w2, [x8, x23, lsl #2]
	cmp	w2, #128
	b.eq	LBB0_6
; %bb.8:                                ;   in Loop: Header=BB0_7 Depth=1
	cmp	w2, #129
	b.ne	LBB0_13
; %bb.9:                                ;   in Loop: Header=BB0_7 Depth=1
	ldr	w0, [x20]
	mov	x1, x23
	bl	_drm_buffer_pointer_to_dword
	ldr	w1, [x0]
	mov	x0, x22
	bl	_radeon_check_offset
	cbnz	w0, LBB0_6
; %bb.10:
Lloh7:
	adrp	x0, l_.str.1@PAGE
Lloh8:
	add	x0, x0, l_.str.1@PAGEOFF
	b	LBB0_2
LBB0_11:
	add	w0, w19, #1
	bl	_BEGIN_RING
	sub	w1, w19, #1
	mov	x0, x21
	bl	_CP_PACKET0
	bl	_OUT_RING
	ldr	w0, [x20]
	mov	x1, x19
	bl	_OUT_RING_DRM_BUFFER
	bl	_ADVANCE_RING
	mov	w0, #0
LBB0_12:
	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
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
LBB0_13:
Lloh9:
	adrp	x0, l_.str.2@PAGE
Lloh10:
	add	x0, x0, l_.str.2@PAGEOFF
	mov	x1, x24
	b	LBB0_3
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpAdd	Lloh9, Lloh10
	.cfi_endproc
                                        ; -- End function
	.comm	_RING_LOCALS,4,2                ; @RING_LOCALS
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Cannot emit more than 64 values at a time (reg=%04x sz=%d)\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_r300_reg_flags,8,3             ; @r300_reg_flags
l_.str.1:                               ; @.str.1
	.asciz	"Offset failed range check (reg=%04x sz=%d)\n"

l_.str.2:                               ; @.str.2
	.asciz	"Register %04x failed check as flag=%02x\n"

	.no_dead_strip	_r300_emit_carefully_checked_packet0
.subsections_via_symbols
