	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function amdgpu_cs_wait_any_fence
_amdgpu_cs_wait_any_fence:              ## @amdgpu_cs_wait_any_fence
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rcx, %rbx
	movq	%rdx, %r15
	movq	%rsi, -80(%rbp)                 ## 8-byte Spill
	movq	%rdi, -72(%rbp)                 ## 8-byte Spill
	movl	4(%rdx), %edi
	callq	_amdgpu_gem_timeout
	movq	%rax, %r12
	movl	(%r15), %r14d
	movl	$-1, -44(%rbp)
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movl	%r14d, %edi
	movl	$8, %esi
	callq	_kcalloc
	testq	%rax, %rax
	je	LBB0_19
## %bb.1:
	movq	%rax, %r13
	movq	%r12, -64(%rbp)                 ## 8-byte Spill
	movq	%r15, -56(%rbp)                 ## 8-byte Spill
	testq	%r14, %r14
	je	LBB0_8
## %bb.2:
	xorl	%r15d, %r15d
	.p2align	4, 0x90
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	movq	-72(%rbp), %rdi                 ## 8-byte Reload
	movq	-80(%rbp), %rsi                 ## 8-byte Reload
	movq	%rbx, %rdx
	callq	_amdgpu_cs_get_fence
	movq	%rax, %r12
	movq	%rax, %rdi
	callq	_IS_ERR
	testq	%rax, %rax
	jne	LBB0_6
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=1
	testq	%r12, %r12
	je	LBB0_5
## %bb.7:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	%r12, (%r13,%r15,8)
	incq	%r15
	addq	$4, %rbx
	cmpq	%r15, %r14
	jne	LBB0_3
LBB0_8:
	leaq	-44(%rbp), %r8
	movq	%r13, %rdi
	movl	%r14d, %esi
	movl	$1, %edx
	movq	-64(%rbp), %rcx                 ## 8-byte Reload
	callq	_dma_fence_wait_any_timeout
	movq	%rax, %r15
	testq	%rax, %rax
	jns	LBB0_9
	jmp	LBB0_14
LBB0_19:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%r15d, %r15d
	subl	(%rax), %r15d
	jmp	LBB0_18
LBB0_6:
	movq	%r12, %rdi
	callq	_PTR_ERR
	movq	%rax, %r15
	testq	%r14, %r14
	jne	LBB0_15
	jmp	LBB0_17
LBB0_5:
	movl	%r15d, -44(%rbp)
	movl	$1, %r15d
LBB0_9:
	movq	-56(%rbp), %rbx                 ## 8-byte Reload
	movq	%rbx, %rdi
	xorl	%esi, %esi
	movl	$8, %edx
	callq	_memset
	xorl	%eax, %eax
	testq	%r15, %r15
	setne	%al
	movl	%eax, (%rbx)
	movl	-44(%rbp), %eax
	movl	%eax, 4(%rbx)
	cmpl	%r14d, %eax
	jae	LBB0_10
## %bb.11:
	movq	(%r13,%rax,8), %rax
	testq	%rax, %rax
	je	LBB0_12
## %bb.13:
	movq	(%rax), %r15
	testq	%r14, %r14
	jne	LBB0_15
	jmp	LBB0_17
LBB0_10:
	xorl	%r15d, %r15d
LBB0_14:
	testq	%r14, %r14
	je	LBB0_17
LBB0_15:
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_16:                                ## =>This Inner Loop Header: Depth=1
	movq	(%r13,%rbx,8), %rdi
	callq	_dma_fence_put
	incq	%rbx
	cmpq	%rbx, %r14
	jne	LBB0_16
LBB0_17:
	movq	%r13, %rdi
	callq	_kfree
LBB0_18:
	movl	%r15d, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_12:
	xorl	%r15d, %r15d
	testq	%r14, %r14
	jne	LBB0_15
	jmp	LBB0_17
	.cfi_endproc
                                        ## -- End function
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.no_dead_strip	_amdgpu_cs_wait_any_fence
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function amdgpu_cs_wait_any_fence
_amdgpu_cs_wait_any_fence:              ; @amdgpu_cs_wait_any_fence
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x23, x3
	mov	x21, x2
	mov	x24, x1
	mov	x25, x0
	ldr	w0, [x2, #4]
	bl	_amdgpu_gem_timeout
	mov	x22, x0
	ldr	w19, [x21]
	mov	w8, #-1
	str	w8, [sp, #12]
Lloh0:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh2:
	ldr	w2, [x8]
	mov	x0, x19
	mov	w1, #8
	bl	_kcalloc
	cbz	x0, LBB0_7
; %bb.1:
	mov	x20, x0
	cbz	w19, LBB0_6
; %bb.2:
	mov	x27, #0
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x25
	mov	x1, x24
	mov	x2, x23
	bl	_amdgpu_cs_get_fence
	mov	x26, x0
	bl	_IS_ERR
	cbnz	x0, LBB0_8
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	cbz	x26, LBB0_9
; %bb.5:                                ;   in Loop: Header=BB0_3 Depth=1
	str	x26, [x20, x27, lsl #3]
	add	x27, x27, #1
	add	x23, x23, #4
	cmp	x19, x27
	b.ne	LBB0_3
LBB0_6:
	add	x4, sp, #12
	mov	x0, x20
	mov	x1, x19
	mov	w2, #1
	mov	x3, x22
	bl	_dma_fence_wait_any_timeout
	mov	x22, x0
	tbz	x0, #63, LBB0_10
	b	LBB0_14
LBB0_7:
Lloh3:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh4:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	neg	w22, w8
	b	LBB0_18
LBB0_8:
	mov	x0, x26
	bl	_PTR_ERR
	mov	x22, x0
	cbnz	w19, LBB0_15
	b	LBB0_17
LBB0_9:
	str	w27, [sp, #12]
	mov	w22, #1
LBB0_10:
	mov	x0, x21
	mov	w1, #0
	mov	w2, #8
	bl	_memset
	cmp	x22, #0
	ldr	w8, [sp, #12]
	cset	w9, ne
	stp	w9, w8, [x21]
	cmp	w8, w19
	b.hs	LBB0_13
; %bb.11:
	ldr	x8, [x20, x8, lsl #3]
	cbz	x8, LBB0_19
; %bb.12:
	ldr	x22, [x8]
	cbnz	w19, LBB0_15
	b	LBB0_17
LBB0_13:
	mov	x22, #0
LBB0_14:
	cbz	w19, LBB0_17
LBB0_15:
	mov	x21, x20
LBB0_16:                                ; =>This Inner Loop Header: Depth=1
	ldr	x0, [x21], #8
	bl	_dma_fence_put
	subs	x19, x19, #1
	b.ne	LBB0_16
LBB0_17:
	mov	x0, x20
	bl	_kfree
LBB0_18:
	mov	x0, x22
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
LBB0_19:
	mov	x22, #0
	cbnz	w19, LBB0_15
	b	LBB0_17
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.cfi_endproc
                                        ; -- End function
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.no_dead_strip	_amdgpu_cs_wait_any_fence
.subsections_via_symbols
