	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function radeon_gem_set_domain
_radeon_gem_set_domain:                 ## @radeon_gem_set_domain
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %rbx
	movq	%rsi, %r15
	callq	_gem_to_radeon_bo
	testq	%rbx, %rbx
	cmovneq	%rbx, %r15
	testq	%r15, %r15
	je	LBB0_1
## %bb.2:
	movq	%rax, %r14
	movq	_RADEON_GEM_DOMAIN_CPU@GOTPCREL(%rip), %rax
	cmpq	(%rax), %r15
	jne	LBB0_6
## %bb.3:
	movl	8(%r14), %edi
	movq	_HZ@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, %ecx
	shll	$5, %ecx
	subl	%eax, %ecx
	subl	%eax, %ecx
	movl	$1, %esi
	movl	$1, %edx
	callq	_dma_resv_wait_timeout_rcu
	movq	_EBUSY@GOTPCREL(%rip), %rcx
	xorl	%ebx, %ebx
	subq	(%rcx), %rbx
	testq	%rax, %rax
	cmovneq	%rax, %rbx
	testq	%rbx, %rbx
	jns	LBB0_6
## %bb.4:
	movq	_EINTR@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	addq	%rbx, %rax
	jne	LBB0_5
LBB0_6:
	movq	_RADEON_GEM_DOMAIN_VRAM@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	cmpq	(%rax), %r15
	jne	LBB0_9
## %bb.7:
	cmpq	$0, (%r14)
	je	LBB0_9
## %bb.8:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_9
LBB0_1:
	leaq	L_.str(%rip), %rdi
	callq	_pr_warn
	xorl	%ebx, %ebx
LBB0_9:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_5:
	leaq	L_.str.1(%rip), %rdi
	movq	%rbx, %rsi
	callq	_pr_err
	jmp	LBB0_9
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Set domain without domain !\n"

	.comm	_RADEON_GEM_DOMAIN_CPU,8,3      ## @RADEON_GEM_DOMAIN_CPU
	.comm	_HZ,4,2                         ## @HZ
	.comm	_EBUSY,8,3                      ## @EBUSY
	.comm	_EINTR,8,3                      ## @EINTR
L_.str.1:                               ## @.str.1
	.asciz	"Failed to wait for object: %li\n"

	.comm	_RADEON_GEM_DOMAIN_VRAM,8,3     ## @RADEON_GEM_DOMAIN_VRAM
	.comm	_EINVAL,4,2                     ## @EINVAL
	.no_dead_strip	_radeon_gem_set_domain
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function radeon_gem_set_domain
_radeon_gem_set_domain:                 ; @radeon_gem_set_domain
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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	x20, x2
	mov	x21, x1
	bl	_gem_to_radeon_bo
	cmp	x20, #0
	csel	x21, x21, x20, eq
	cbz	x21, LBB0_7
; %bb.1:
	mov	x19, x0
Lloh0:
	adrp	x8, _RADEON_GEM_DOMAIN_CPU@GOTPAGE
Lloh1:
	ldr	x8, [x8, _RADEON_GEM_DOMAIN_CPU@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	cmp	x21, x8
	b.ne	LBB0_4
; %bb.2:
	ldr	w0, [x19, #8]
Lloh3:
	adrp	x8, _HZ@GOTPAGE
Lloh4:
	ldr	x8, [x8, _HZ@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	mov	w9, #30
	mul	w3, w8, w9
	mov	w1, #1
	mov	w2, #1
	bl	_dma_resv_wait_timeout_rcu
Lloh6:
	adrp	x8, _EBUSY@GOTPAGE
Lloh7:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
Lloh8:
	ldr	x8, [x8]
	cmp	x0, #0
	csneg	x20, x0, x8, ne
	tbz	x20, #63, LBB0_4
; %bb.3:
Lloh9:
	adrp	x8, _EINTR@GOTPAGE
Lloh10:
	ldr	x8, [x8, _EINTR@GOTPAGEOFF]
Lloh11:
	ldr	x8, [x8]
	cmn	x20, x8
	b.ne	LBB0_10
LBB0_4:
Lloh12:
	adrp	x8, _RADEON_GEM_DOMAIN_VRAM@GOTPAGE
Lloh13:
	ldr	x8, [x8, _RADEON_GEM_DOMAIN_VRAM@GOTPAGEOFF]
Lloh14:
	ldr	x8, [x8]
	cmp	x21, x8
	b.ne	LBB0_8
; %bb.5:
	ldr	x8, [x19]
	cbz	x8, LBB0_8
; %bb.6:
Lloh15:
	adrp	x8, _EINVAL@GOTPAGE
Lloh16:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh17:
	ldr	w8, [x8]
	neg	w20, w8
	b	LBB0_9
LBB0_7:
Lloh18:
	adrp	x0, l_.str@PAGE
Lloh19:
	add	x0, x0, l_.str@PAGEOFF
	bl	_pr_warn
LBB0_8:
	mov	w20, #0
LBB0_9:
	mov	x0, x20
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
LBB0_10:
Lloh20:
	adrp	x0, l_.str.1@PAGE
Lloh21:
	add	x0, x0, l_.str.1@PAGEOFF
	mov	x1, x20
	bl	_pr_err
	b	LBB0_9
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpAdd	Lloh20, Lloh21
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Set domain without domain !\n"

	.comm	_RADEON_GEM_DOMAIN_CPU,8,3      ; @RADEON_GEM_DOMAIN_CPU
	.comm	_HZ,4,2                         ; @HZ
	.comm	_EBUSY,8,3                      ; @EBUSY
	.comm	_EINTR,8,3                      ; @EINTR
l_.str.1:                               ; @.str.1
	.asciz	"Failed to wait for object: %li\n"

	.comm	_RADEON_GEM_DOMAIN_VRAM,8,3     ; @RADEON_GEM_DOMAIN_VRAM
	.comm	_EINVAL,4,2                     ; @EINVAL
	.no_dead_strip	_radeon_gem_set_domain
.subsections_via_symbols
