	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_radeon_cs_ioctl                ## -- Begin function radeon_cs_ioctl
	.p2align	4, 0x90
_radeon_cs_ioctl:                       ## @radeon_cs_ioctl
	.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
	subq	$32, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %r15
	movq	%rsi, %r14
	movq	(%rdi), %rbx
	movq	%rbx, %rdi
	callq	_down_read
	cmpl	$0, 24(%rbx)
	je	LBB0_1
## %bb.2:
	cmpq	$0, 16(%rbx)
	je	LBB0_4
## %bb.3:
	movq	%rbx, %rdi
	callq	_up_read
	movq	%rbx, %rdi
	callq	_radeon_gpu_reset
	movq	_EAGAIN@GOTPCREL(%rip), %rdx
	xorl	%ecx, %ecx
	subl	(%rdx), %ecx
	testl	%eax, %eax
	cmovnel	%eax, %ecx
	jmp	LBB0_15
LBB0_1:
	movq	%rbx, %rdi
	callq	_up_read
	movq	_EBUSY@GOTPCREL(%rip), %rax
	xorl	%ecx, %ecx
	subl	(%rax), %ecx
	jmp	LBB0_15
LBB0_4:
	leaq	-56(%rbp), %r12
	movq	%r12, %rdi
	xorl	%esi, %esi
	movl	$24, %edx
	callq	_memset
	movq	%r15, -40(%rbp)
	movq	%rbx, -48(%rbp)
	movl	8(%rbx), %eax
	movl	%eax, -52(%rbp)
	movl	4(%rbx), %eax
	movl	%eax, -56(%rbp)
	movq	%r12, %rdi
	movq	%r14, %rsi
	callq	_radeon_cs_parser_init
	testl	%eax, %eax
	je	LBB0_6
## %bb.5:
	movl	%eax, %r14d
	leaq	L_.str(%rip), %rdi
	xorl	%eax, %eax
	callq	_DRM_ERROR
	jmp	LBB0_10
LBB0_6:
	leaq	-56(%rbp), %rsi
	movq	%rbx, %rdi
	callq	_radeon_cs_ib_fill
	movl	%eax, %r14d
	testl	%eax, %eax
	je	LBB0_7
LBB0_10:
	leaq	-56(%rbp), %rdi
	movl	%r14d, %esi
	xorl	%edx, %edx
LBB0_14:
	callq	_radeon_cs_parser_fini
	movq	%rbx, %rdi
	callq	_up_read
	movq	%rbx, %rdi
	movl	%r14d, %esi
	callq	_radeon_cs_handle_lockup
	movl	%eax, %ecx
LBB0_15:
	movl	%ecx, %eax
	addq	$32, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_7:
	leaq	-56(%rbp), %rdi
	callq	_radeon_cs_parser_relocs
	testl	%eax, %eax
	je	LBB0_11
## %bb.8:
	movl	%eax, %r14d
	movq	_ERESTARTSYS@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	addl	%r14d, %eax
	je	LBB0_10
## %bb.9:
	leaq	L_.str.1(%rip), %rdi
	movl	%r14d, %esi
	xorl	%eax, %eax
	callq	_DRM_ERROR
	jmp	LBB0_10
LBB0_11:
	leaq	-56(%rbp), %r14
	movq	%r14, %rdi
	callq	_trace_radeon_cs
	movq	%rbx, %rdi
	movq	%r14, %rsi
	callq	_radeon_cs_ib_chunk
	movl	%eax, %r14d
	testl	%eax, %eax
	jne	LBB0_13
## %bb.12:
	leaq	-56(%rbp), %rsi
	movq	%rbx, %rdi
	callq	_radeon_cs_ib_vm_chunk
	movl	%eax, %r14d
LBB0_13:
	leaq	-56(%rbp), %rdi
	movl	%r14d, %esi
	movl	$1, %edx
	jmp	LBB0_14
	.cfi_endproc
                                        ## -- End function
	.comm	_EBUSY,4,2                      ## @EBUSY
	.comm	_EAGAIN,4,2                     ## @EAGAIN
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Failed to initialize parser !\n"

	.comm	_ERESTARTSYS,4,2                ## @ERESTARTSYS
L_.str.1:                               ## @.str.1
	.asciz	"Failed to parse relocation %d!\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_radeon_cs_ioctl                ; -- Begin function radeon_cs_ioctl
	.p2align	2
_radeon_cs_ioctl:                       ; @radeon_cs_ioctl
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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, x2
	mov	x20, x1
	ldr	x19, [x0]
	mov	x0, x19
	bl	_down_read
	ldr	w8, [x19, #24]
	cbz	w8, LBB0_3
; %bb.1:
	ldr	x8, [x19, #16]
	cbz	x8, LBB0_4
; %bb.2:
	mov	x0, x19
	bl	_up_read
	mov	x0, x19
	bl	_radeon_gpu_reset
Lloh0:
	adrp	x8, _EAGAIN@GOTPAGE
Lloh1:
	ldr	x8, [x8, _EAGAIN@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w0, #0
	csneg	w0, w0, w8, ne
	b	LBB0_10
LBB0_3:
	mov	x0, x19
	bl	_up_read
Lloh3:
	adrp	x8, _EBUSY@GOTPAGE
Lloh4:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_10
LBB0_4:
	add	x0, sp, #8
	mov	w1, #0
	mov	w2, #24
	bl	_memset
	stp	x19, x21, [sp, #16]
	ldur	d0, [x19, #4]
	str	d0, [sp, #8]
	add	x0, sp, #8
	mov	x1, x20
	bl	_radeon_cs_parser_init
	cbz	w0, LBB0_7
; %bb.5:
	mov	x20, x0
Lloh6:
	adrp	x0, l_.str@PAGE
Lloh7:
	add	x0, x0, l_.str@PAGEOFF
	bl	_DRM_ERROR
	add	x0, sp, #8
	mov	x1, x20
	mov	w2, #0
LBB0_6:
	bl	_radeon_cs_parser_fini
	mov	x0, x19
	bl	_up_read
	mov	x0, x19
	mov	x1, x20
	b	LBB0_9
LBB0_7:
	add	x1, sp, #8
	mov	x0, x19
	bl	_radeon_cs_ib_fill
	mov	x20, x0
	cbz	w0, LBB0_11
LBB0_8:
	add	x0, sp, #8
	mov	x1, x20
	mov	w2, #0
	bl	_radeon_cs_parser_fini
	mov	x0, x19
	bl	_up_read
	mov	x0, x19
	mov	x1, x20
LBB0_9:
	bl	_radeon_cs_handle_lockup
LBB0_10:
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
LBB0_11:
	add	x0, sp, #8
	bl	_radeon_cs_parser_relocs
	cbz	w0, LBB0_14
; %bb.12:
	mov	x20, x0
Lloh8:
	adrp	x8, _ERESTARTSYS@GOTPAGE
Lloh9:
	ldr	x8, [x8, _ERESTARTSYS@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
	cmn	w0, w8
	b.eq	LBB0_8
; %bb.13:
	str	x20, [sp]
Lloh11:
	adrp	x0, l_.str.1@PAGE
Lloh12:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_DRM_ERROR
	b	LBB0_8
LBB0_14:
	add	x0, sp, #8
	bl	_trace_radeon_cs
	add	x1, sp, #8
	mov	x0, x19
	bl	_radeon_cs_ib_chunk
	mov	x20, x0
	cbnz	w0, LBB0_16
; %bb.15:
	add	x1, sp, #8
	mov	x0, x19
	bl	_radeon_cs_ib_vm_chunk
	mov	x20, x0
LBB0_16:
	add	x0, sp, #8
	mov	x1, x20
	mov	w2, #1
	b	LBB0_6
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpAdd	Lloh11, Lloh12
	.cfi_endproc
                                        ; -- End function
	.comm	_EBUSY,4,2                      ; @EBUSY
	.comm	_EAGAIN,4,2                     ; @EAGAIN
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Failed to initialize parser !\n"

	.comm	_ERESTARTSYS,4,2                ; @ERESTARTSYS
l_.str.1:                               ; @.str.1
	.asciz	"Failed to parse relocation %d!\n"

.subsections_via_symbols
