	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function radeon_emit_packets
_radeon_emit_packets:                   ## @radeon_emit_packets
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %rbx
	movq	_RADEON_MAX_STATE_PACKETS@GOTPCREL(%rip), %rax
	cmpl	%ebx, (%rax)
	jle	LBB0_6
## %bb.1:
	movq	%rcx, %r12
	movq	%rsi, %r13
	movq	%rdi, %r15
	movq	_packet@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movslq	%ebx, %rcx
	movslq	(%rax,%rcx,8), %rdx
	movl	4(%rax,%rcx,8), %eax
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movq	%rdx, -56(%rbp)                 ## 8-byte Spill
	leaq	(,%rdx,4), %r14
	movl	(%r12), %edi
	callq	_drm_buffer_unprocessed
	cltq
	cmpq	%rax, %r14
	jbe	LBB0_3
## %bb.2:
	leaq	L_.str(%rip), %rdi
	jmp	LBB0_5
LBB0_3:
	movl	(%r12), %ecx
	movq	%r15, %rdi
	movq	%r13, %rsi
	movl	%ebx, %edx
	callq	_radeon_check_and_fixup_packets
	testq	%rax, %rax
	je	LBB0_8
## %bb.4:
	leaq	L_.str.1(%rip), %rdi
LBB0_5:
	callq	_DRM_ERROR
LBB0_6:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_7:
	movl	%ebx, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_8:
	movq	-56(%rbp), %rbx                 ## 8-byte Reload
	leal	1(%rbx), %edi
	callq	_BEGIN_RING
	leal	-1(%rbx), %esi
	movl	-44(%rbp), %edi                 ## 4-byte Reload
	callq	_CP_PACKET0
	movl	%eax, %edi
	callq	_OUT_RING
	movl	(%r12), %edi
	movl	%ebx, %esi
	callq	_OUT_RING_DRM_BUFFER
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_ADVANCE_RING
	jmp	LBB0_7
	.cfi_endproc
                                        ## -- End function
	.comm	_RING_LOCALS,4,2                ## @RING_LOCALS
	.comm	_RADEON_MAX_STATE_PACKETS,4,2   ## @RADEON_MAX_STATE_PACKETS
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_packet,8,3                     ## @packet
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Packet size provided larger than data provided\n"

L_.str.1:                               ## @.str.1
	.asciz	"Packet verification failed\n"

	.no_dead_strip	_radeon_emit_packets
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function radeon_emit_packets
_radeon_emit_packets:                   ; @radeon_emit_packets
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	mov	x22, x2
Lloh0:
	adrp	x8, _RADEON_MAX_STATE_PACKETS@GOTPAGE
Lloh1:
	ldr	x8, [x8, _RADEON_MAX_STATE_PACKETS@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w8, w22
	b.le	LBB0_6
; %bb.1:
	mov	x19, x3
	mov	x23, x1
	mov	x24, x0
Lloh3:
	adrp	x8, _packet@GOTPAGE
Lloh4:
	ldr	x8, [x8, _packet@GOTPAGEOFF]
Lloh5:
	ldr	x8, [x8]
	lsl	x9, x22, #32
	add	x8, x8, x9, asr #29
	ldp	w20, w21, [x8]
                                        ; kill: def $w20 killed $w20 def $x20
	sxtw	x20, w20
	ldr	w0, [x3]
	bl	_drm_buffer_unprocessed
                                        ; kill: def $w0 killed $w0 def $x0
	sxtw	x8, w0
	cmp	x8, x20, lsl #2
	b.hs	LBB0_3
; %bb.2:
Lloh6:
	adrp	x0, l_.str@PAGE
Lloh7:
	add	x0, x0, l_.str@PAGEOFF
	b	LBB0_5
LBB0_3:
	ldr	w3, [x19]
	mov	x0, x24
	mov	x1, x23
	mov	x2, x22
	bl	_radeon_check_and_fixup_packets
	cbz	x0, LBB0_8
; %bb.4:
Lloh8:
	adrp	x0, l_.str.1@PAGE
Lloh9:
	add	x0, x0, l_.str.1@PAGEOFF
LBB0_5:
	bl	_DRM_ERROR
LBB0_6:
Lloh10:
	adrp	x8, _EINVAL@GOTPAGE
Lloh11:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh12:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_7:
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
LBB0_8:
	add	w0, w20, #1
	bl	_BEGIN_RING
	sub	w1, w20, #1
	mov	x0, x21
	bl	_CP_PACKET0
	bl	_OUT_RING
	ldr	w0, [x19]
	mov	x1, x20
	bl	_OUT_RING_DRM_BUFFER
	bl	_ADVANCE_RING
	mov	w0, #0
	b	LBB0_7
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.cfi_endproc
                                        ; -- End function
	.comm	_RING_LOCALS,4,2                ; @RING_LOCALS
	.comm	_RADEON_MAX_STATE_PACKETS,4,2   ; @RADEON_MAX_STATE_PACKETS
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_packet,8,3                     ; @packet
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Packet size provided larger than data provided\n"

l_.str.1:                               ; @.str.1
	.asciz	"Packet verification failed\n"

	.no_dead_strip	_radeon_emit_packets
.subsections_via_symbols
