	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function radeon_check_and_fixup_packet3
_radeon_check_and_fixup_packet3:        ## @radeon_check_and_fixup_packet3
	.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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rcx, %r15
	movq	%rdx, %r14
	movl	(%rdx), %edi
	xorl	%esi, %esi
	callq	_drm_buffer_pointer_to_dword
	movq	%rax, %r12
	movq	_RADEON_CP_PACKET_COUNT_MASK@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	andl	(%r12), %ebx
	sarl	$16, %ebx
	addl	$2, %ebx
	movl	%ebx, (%r15)
	movl	$-1073741824, %eax              ## imm = 0xC0000000
	andl	(%r12), %eax
	movq	_RADEON_CP_PACKET3@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	jne	LBB0_1
## %bb.3:
	shll	$2, %ebx
	movl	(%r14), %edi
	callq	_drm_buffer_unprocessed
	cmpl	%eax, %ebx
	jbe	LBB0_5
## %bb.4:
	leaq	L_.str.1(%rip), %rdi
	jmp	LBB0_2
LBB0_1:
	leaq	L_.str(%rip), %rdi
LBB0_2:
	xorl	%eax, %eax
	callq	_DRM_ERROR
	jmp	LBB0_6
LBB0_5:
	movzbl	1(%r12), %esi
	shll	$8, %esi
	leaq	L_.str.12(%rip), %rdi
	xorl	%eax, %eax
	callq	_DRM_ERROR
LBB0_6:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_RADEON_CP_PACKET_COUNT_MASK,4,2 ## @RADEON_CP_PACKET_COUNT_MASK
	.comm	_RADEON_CP_PACKET3,4,2          ## @RADEON_CP_PACKET3
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Not a type 3 packet\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
L_.str.1:                               ## @.str.1
	.asciz	"Packet size larger than size of data provided\n"

	.comm	_UCODE_R200,4,2                 ## @UCODE_R200
	.comm	_UCODE_R100,4,2                 ## @UCODE_R100
	.comm	_RADEON_GMC_SRC_PITCH_OFFSET_CNTL,4,2 ## @RADEON_GMC_SRC_PITCH_OFFSET_CNTL
	.comm	_RADEON_GMC_DST_PITCH_OFFSET_CNTL,4,2 ## @RADEON_GMC_DST_PITCH_OFFSET_CNTL
L_.str.12:                              ## @.str.12
	.asciz	"Invalid packet type %x\n"

	.no_dead_strip	_radeon_check_and_fixup_packet3
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function radeon_check_and_fixup_packet3
_radeon_check_and_fixup_packet3:        ; @radeon_check_and_fixup_packet3
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.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
	mov	x21, x3
	mov	x20, x2
	ldr	w0, [x2]
	mov	w1, #0
	bl	_drm_buffer_pointer_to_dword
Lloh0:
	adrp	x8, _RADEON_CP_PACKET_COUNT_MASK@GOTPAGE
Lloh1:
	ldr	x8, [x8, _RADEON_CP_PACKET_COUNT_MASK@GOTPAGEOFF]
	ldr	w9, [x0]
Lloh2:
	ldr	w8, [x8]
	and	w8, w8, w9
	asr	w8, w8, #16
	add	w22, w8, #2
	str	w22, [x21]
	ldr	w8, [x0]
	and	w8, w8, #0xc0000000
Lloh3:
	adrp	x9, _RADEON_CP_PACKET3@GOTPAGE
Lloh4:
	ldr	x9, [x9, _RADEON_CP_PACKET3@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	cmp	w8, w9
	b.ne	LBB0_3
; %bb.1:
	mov	x19, x0
	ldr	w0, [x20]
	bl	_drm_buffer_unprocessed
	cmp	w0, w22, lsl #2
	b.hs	LBB0_4
; %bb.2:
Lloh6:
	adrp	x0, l_.str.1@PAGE
Lloh7:
	add	x0, x0, l_.str.1@PAGEOFF
	b	LBB0_5
LBB0_3:
Lloh8:
	adrp	x0, l_.str@PAGE
Lloh9:
	add	x0, x0, l_.str@PAGEOFF
	b	LBB0_5
LBB0_4:
	ldrb	w8, [x19, #1]
	lsl	w8, w8, #8
	str	x8, [sp]
Lloh10:
	adrp	x0, l_.str.12@PAGE
Lloh11:
	add	x0, x0, l_.str.12@PAGEOFF
LBB0_5:
	bl	_DRM_ERROR
Lloh12:
	adrp	x8, _EINVAL@GOTPAGE
Lloh13:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh14:
	ldr	w8, [x8]
	neg	w0, w8
	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
	add	sp, sp, #64
	ret
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
	.comm	_RADEON_CP_PACKET_COUNT_MASK,4,2 ; @RADEON_CP_PACKET_COUNT_MASK
	.comm	_RADEON_CP_PACKET3,4,2          ; @RADEON_CP_PACKET3
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Not a type 3 packet\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
l_.str.1:                               ; @.str.1
	.asciz	"Packet size larger than size of data provided\n"

	.comm	_UCODE_R200,4,2                 ; @UCODE_R200
	.comm	_UCODE_R100,4,2                 ; @UCODE_R100
	.comm	_RADEON_GMC_SRC_PITCH_OFFSET_CNTL,4,2 ; @RADEON_GMC_SRC_PITCH_OFFSET_CNTL
	.comm	_RADEON_GMC_DST_PITCH_OFFSET_CNTL,4,2 ; @RADEON_GMC_DST_PITCH_OFFSET_CNTL
l_.str.12:                              ; @.str.12
	.asciz	"Invalid packet type %x\n"

	.no_dead_strip	_radeon_check_and_fixup_packet3
.subsections_via_symbols
