	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function test_rm_callback
_test_rm_callback:                      ## @test_rm_callback
	.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	$16, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	xorps	%xmm0, %xmm0
	movaps	%xmm0, -48(%rbp)
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	xorl	%r12d, %r12d
	subl	(%rax), %r12d
	xorl	%eax, %eax
	callq	_mock_fence
	testq	%rax, %rax
	je	LBB0_1
## %bb.2:
	movq	%rax, %r14
	leaq	-40(%rbp), %r15
	movq	_simple_callback@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r14, %rdi
	movq	%r15, %rsi
	callq	_dma_fence_add_callback
	testq	%rax, %rax
	je	LBB0_4
## %bb.3:
	leaq	L_.str(%rip), %rdi
LBB0_8:
	callq	_pr_err
LBB0_9:
	movq	%r14, %rdi
	callq	_dma_fence_put
	jmp	LBB0_10
LBB0_1:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	subl	(%rax), %ebx
	movl	%ebx, %r12d
LBB0_10:
	movl	%r12d, %eax
	addq	$16, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_4:
	movq	%r14, %rdi
	movq	%r15, %rsi
	callq	_dma_fence_remove_callback
	testl	%eax, %eax
	je	LBB0_5
## %bb.6:
	movq	%r14, %rdi
	callq	_dma_fence_signal
	cmpq	$0, -48(%rbp)
	je	LBB0_11
## %bb.7:
	leaq	L_.str.2(%rip), %rdi
	jmp	LBB0_8
LBB0_5:
	leaq	L_.str.1(%rip), %rdi
	jmp	LBB0_8
LBB0_11:
	xorl	%r12d, %r12d
	jmp	LBB0_9
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_simple_callback,4,2            ## @simple_callback
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Failed to add callback, fence already signaled!\n"

L_.str.1:                               ## @.str.1
	.asciz	"Failed to remove callback!\n"

L_.str.2:                               ## @.str.2
	.asciz	"Callback still signaled after removal!\n"

	.no_dead_strip	_test_rm_callback
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function test_rm_callback
_test_rm_callback:                      ; @test_rm_callback
	.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
	stp	xzr, xzr, [sp]
Lloh0:
	adrp	x8, _EINVAL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh2:
	ldr	w21, [x8]
	bl	_mock_fence
	cbz	x0, LBB0_5
; %bb.1:
	mov	x19, x0
	mov	x8, sp
	add	x20, x8, #8
Lloh3:
	adrp	x8, _simple_callback@GOTPAGE
Lloh4:
	ldr	x8, [x8, _simple_callback@GOTPAGEOFF]
Lloh5:
	ldr	w2, [x8]
	mov	x1, x20
	bl	_dma_fence_add_callback
	cbz	x0, LBB0_7
; %bb.2:
Lloh6:
	adrp	x0, l_.str@PAGE
Lloh7:
	add	x0, x0, l_.str@PAGEOFF
LBB0_3:
	neg	w20, w21
	bl	_pr_err
LBB0_4:
	mov	x0, x19
	bl	_dma_fence_put
	b	LBB0_6
LBB0_5:
Lloh8:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh9:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
	neg	w20, w8
LBB0_6:
	mov	x0, x20
	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
LBB0_7:
	mov	x0, x19
	mov	x1, x20
	bl	_dma_fence_remove_callback
	cbz	w0, LBB0_10
; %bb.8:
	mov	x0, x19
	bl	_dma_fence_signal
	ldr	x8, [sp]
	cbz	x8, LBB0_11
; %bb.9:
Lloh11:
	adrp	x0, l_.str.2@PAGE
Lloh12:
	add	x0, x0, l_.str.2@PAGEOFF
	b	LBB0_3
LBB0_10:
Lloh13:
	adrp	x0, l_.str.1@PAGE
Lloh14:
	add	x0, x0, l_.str.1@PAGEOFF
	b	LBB0_3
LBB0_11:
	mov	w20, #0
	b	LBB0_4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpAdd	Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_simple_callback,4,2            ; @simple_callback
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Failed to add callback, fence already signaled!\n"

l_.str.1:                               ; @.str.1
	.asciz	"Failed to remove callback!\n"

l_.str.2:                               ; @.str.2
	.asciz	"Callback still signaled after removal!\n"

	.no_dead_strip	_test_rm_callback
.subsections_via_symbols
