	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_amdgpu_cs_wait_ioctl           ## -- Begin function amdgpu_cs_wait_ioctl
	.p2align	4, 0x90
_amdgpu_cs_wait_ioctl:                  ## @amdgpu_cs_wait_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	%r13
	pushq	%r12
	pushq	%rbx
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %rbx
	movq	%rsi, %r13
	movl	20(%rsi), %edi
	callq	_amdgpu_gem_timeout
	movq	%rax, %r15
	movl	(%rbx), %edi
	movl	16(%r13), %esi
	callq	_amdgpu_ctx_get
	testq	%rax, %rax
	je	LBB0_1
## %bb.2:
	movq	%rax, %r14
	movl	12(%r13), %esi
	movl	4(%r13), %ecx
	movl	8(%r13), %edx
	leaq	-48(%rbp), %r8
	movq	%rax, %rdi
	callq	_amdgpu_ctx_get_entity
	testq	%rax, %rax
	je	LBB0_4
## %bb.3:
	movq	%rax, %rbx
	movq	%r14, %rdi
	callq	_amdgpu_ctx_put
	jmp	LBB0_14
LBB0_1:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_14
LBB0_4:
	movq	-48(%rbp), %rsi
	movl	(%r13), %edx
	movq	%r14, %rdi
	callq	_amdgpu_ctx_get_fence
	movq	%rax, %r12
	movq	%rax, %rdi
	callq	_IS_ERR
	testq	%rax, %rax
	je	LBB0_6
## %bb.5:
	movq	%r12, %rdi
	callq	_PTR_ERR
	movq	%rax, %r15
	jmp	LBB0_12
LBB0_6:
	testq	%r12, %r12
	je	LBB0_7
## %bb.9:
	movq	%r12, %rdi
	movl	$1, %esi
	movq	%r15, %rdx
	callq	_dma_fence_wait_timeout
	movq	%rax, %r15
	testq	%rax, %rax
	jle	LBB0_11
## %bb.10:
	movq	(%r12), %rax
	testq	%rax, %rax
	cmovneq	%rax, %r15
LBB0_11:
	movq	%r12, %rdi
	callq	_dma_fence_put
LBB0_12:
	movq	%r14, %rdi
	callq	_amdgpu_ctx_put
	testq	%r15, %r15
	jns	LBB0_8
## %bb.13:
	movl	%r15d, %ebx
	jmp	LBB0_14
LBB0_7:
	movq	%r14, %rdi
	callq	_amdgpu_ctx_put
	movl	$1, %r15d
LBB0_8:
	xorl	%ebx, %ebx
	movq	%r13, %rdi
	xorl	%esi, %esi
	movl	$24, %edx
	callq	_memset
	xorl	%eax, %eax
	testq	%r15, %r15
	sete	%al
	movl	%eax, (%r13)
LBB0_14:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_amdgpu_cs_wait_ioctl           ; -- Begin function amdgpu_cs_wait_ioctl
	.p2align	2
_amdgpu_cs_wait_ioctl:                  ; @amdgpu_cs_wait_ioctl
	.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	x20, x2
	mov	x19, x1
	ldr	w0, [x1, #20]
	bl	_amdgpu_gem_timeout
	mov	x21, x0
	ldr	w0, [x20]
	ldr	w1, [x19, #16]
	bl	_amdgpu_ctx_get
	cbz	x0, LBB0_3
; %bb.1:
	mov	x20, x0
	ldp	w2, w1, [x19, #8]
	ldr	w3, [x19, #4]
	add	x4, sp, #8
	bl	_amdgpu_ctx_get_entity
	cbz	x0, LBB0_4
; %bb.2:
	mov	x22, x0
	mov	x0, x20
	bl	_amdgpu_ctx_put
	b	LBB0_14
LBB0_3:
Lloh0:
	adrp	x8, _EINVAL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	neg	w22, w8
	b	LBB0_14
LBB0_4:
	ldr	x1, [sp, #8]
	ldr	w2, [x19]
	mov	x0, x20
	bl	_amdgpu_ctx_get_fence
	mov	x22, x0
	bl	_IS_ERR
	cbz	x0, LBB0_6
; %bb.5:
	mov	x0, x22
	bl	_PTR_ERR
	mov	x21, x0
	b	LBB0_10
LBB0_6:
	cbz	x22, LBB0_12
; %bb.7:
	mov	x0, x22
	mov	w1, #1
	mov	x2, x21
	bl	_dma_fence_wait_timeout
	mov	x21, x0
	cmp	x0, #1
	b.lt	LBB0_9
; %bb.8:
	ldr	x8, [x22]
	cmp	x8, #0
	csel	x21, x21, x8, eq
LBB0_9:
	mov	x0, x22
	bl	_dma_fence_put
LBB0_10:
	mov	x0, x20
	bl	_amdgpu_ctx_put
	tbz	x21, #63, LBB0_13
; %bb.11:
	mov	x22, x21
	b	LBB0_14
LBB0_12:
	mov	x0, x20
	bl	_amdgpu_ctx_put
	mov	w21, #1
LBB0_13:
	mov	x0, x19
	mov	w1, #0
	mov	w2, #24
	bl	_memset
	mov	w22, #0
	cmp	x21, #0
	cset	w8, eq
	str	w8, [x19]
LBB0_14:
	mov	x0, x22
	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	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
.subsections_via_symbols
