	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_cik_semaphore_ring_emit        ## -- Begin function cik_semaphore_ring_emit
	.p2align	4, 0x90
_cik_semaphore_ring_emit:               ## @cik_semaphore_ring_emit
	.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
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%ecx, %r14d
	movq	%rsi, %rbx
	movl	(%rdx), %r15d
	testl	%ecx, %ecx
	jne	LBB0_1
## %bb.2:
	movq	_PACKET3_SEM_SEL_SIGNAL@GOTPCREL(%rip), %rax
	jmp	LBB0_3
LBB0_1:
	movq	_PACKET3_SEM_SEL_WAIT@GOTPCREL(%rip), %rax
LBB0_3:
	movl	(%rax), %r12d
	movq	_PACKET3_MEM_SEMAPHORE@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	$1, %esi
	callq	_PACKET3
	movq	%rbx, %rdi
	movl	%eax, %esi
	callq	_radeon_ring_write
	movl	%r15d, %edi
	callq	_lower_32_bits
	movq	%rbx, %rdi
	movl	%eax, %esi
	callq	_radeon_ring_write
	movl	%r15d, %edi
	callq	_upper_32_bits
	movzwl	%ax, %esi
	orl	%r12d, %esi
	movq	%rbx, %rdi
	callq	_radeon_ring_write
	testl	%r14d, %r14d
	je	LBB0_6
## %bb.4:
	movq	(%rbx), %rax
	movq	_RADEON_RING_TYPE_GFX_INDEX@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_6
## %bb.5:
	movq	_PACKET3_PFP_SYNC_ME@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	xorl	%esi, %esi
	callq	_PACKET3
	movq	%rbx, %rdi
	movl	%eax, %esi
	callq	_radeon_ring_write
	movq	%rbx, %rdi
	xorl	%esi, %esi
	callq	_radeon_ring_write
LBB0_6:
	movl	$1, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_PACKET3_SEM_SEL_WAIT,4,2       ## @PACKET3_SEM_SEL_WAIT
	.comm	_PACKET3_SEM_SEL_SIGNAL,4,2     ## @PACKET3_SEM_SEL_SIGNAL
	.comm	_PACKET3_MEM_SEMAPHORE,4,2      ## @PACKET3_MEM_SEMAPHORE
	.comm	_RADEON_RING_TYPE_GFX_INDEX,8,3 ## @RADEON_RING_TYPE_GFX_INDEX
	.comm	_PACKET3_PFP_SYNC_ME,4,2        ## @PACKET3_PFP_SYNC_ME
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_cik_semaphore_ring_emit        ; -- Begin function cik_semaphore_ring_emit
	.p2align	2
_cik_semaphore_ring_emit:               ; @cik_semaphore_ring_emit
	.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, x3
	mov	x19, x1
	ldr	w21, [x2]
Lloh0:
	adrp	x8, _PACKET3_SEM_SEL_WAIT@GOTPAGE
Lloh1:
	ldr	x8, [x8, _PACKET3_SEM_SEL_WAIT@GOTPAGEOFF]
Lloh2:
	adrp	x9, _PACKET3_SEM_SEL_SIGNAL@GOTPAGE
Lloh3:
	ldr	x9, [x9, _PACKET3_SEM_SEL_SIGNAL@GOTPAGEOFF]
	cmp	w3, #0
	csel	x8, x9, x8, eq
	ldr	w22, [x8]
Lloh4:
	adrp	x8, _PACKET3_MEM_SEMAPHORE@GOTPAGE
Lloh5:
	ldr	x8, [x8, _PACKET3_MEM_SEMAPHORE@GOTPAGEOFF]
Lloh6:
	ldr	w0, [x8]
	mov	w1, #1
	bl	_PACKET3
	mov	x1, x0
	mov	x0, x19
	bl	_radeon_ring_write
	mov	x0, x21
	bl	_lower_32_bits
	mov	x1, x0
	mov	x0, x19
	bl	_radeon_ring_write
	mov	x0, x21
	bl	_upper_32_bits
	and	w8, w0, #0xffff
	orr	w1, w8, w22
	mov	x0, x19
	bl	_radeon_ring_write
	cbz	w20, LBB0_3
; %bb.1:
	ldr	x8, [x19]
Lloh7:
	adrp	x9, _RADEON_RING_TYPE_GFX_INDEX@GOTPAGE
Lloh8:
	ldr	x9, [x9, _RADEON_RING_TYPE_GFX_INDEX@GOTPAGEOFF]
Lloh9:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_3
; %bb.2:
Lloh10:
	adrp	x8, _PACKET3_PFP_SYNC_ME@GOTPAGE
Lloh11:
	ldr	x8, [x8, _PACKET3_PFP_SYNC_ME@GOTPAGEOFF]
Lloh12:
	ldr	w0, [x8]
	mov	w1, #0
	bl	_PACKET3
	mov	x1, x0
	mov	x0, x19
	bl	_radeon_ring_write
	mov	x0, x19
	mov	w1, #0
	bl	_radeon_ring_write
LBB0_3:
	mov	w0, #1
	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
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.cfi_endproc
                                        ; -- End function
	.comm	_PACKET3_SEM_SEL_WAIT,4,2       ; @PACKET3_SEM_SEL_WAIT
	.comm	_PACKET3_SEM_SEL_SIGNAL,4,2     ; @PACKET3_SEM_SEL_SIGNAL
	.comm	_PACKET3_MEM_SEMAPHORE,4,2      ; @PACKET3_MEM_SEMAPHORE
	.comm	_RADEON_RING_TYPE_GFX_INDEX,8,3 ; @RADEON_RING_TYPE_GFX_INDEX
	.comm	_PACKET3_PFP_SYNC_ME,4,2        ; @PACKET3_PFP_SYNC_ME
.subsections_via_symbols
