	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function stop_ring
_stop_ring:                             ## @stop_ring
	.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	%rdi, %rbx
	movq	16(%rdi), %rdi
	callq	_INTEL_GEN
	cmpl	$3, %eax
	jl	LBB0_3
## %bb.1:
	movq	_STOP_RING@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	__MASKED_BIT_ENABLE
	movq	_RING_MI_MODE@GOTPCREL(%rip), %rsi
	movq	%rbx, %rdi
	movl	%eax, %edx
	callq	_ENGINE_WRITE
	movl	4(%rbx), %edi
	movl	8(%rbx), %r14d
	callq	_RING_MI_MODE
	movq	_MODE_IDLE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movl	%r14d, %edi
	movl	%eax, %esi
	movl	%ecx, %edx
	movl	$1000, %r8d                     ## imm = 0x3E8
	callq	_intel_wait_for_register
	testq	%rax, %rax
	je	LBB0_3
## %bb.2:
	movl	(%rbx), %esi
	leaq	L_.str(%rip), %rdi
	callq	_DRM_ERROR
	movq	_RING_HEAD@GOTPCREL(%rip), %rsi
	movq	%rbx, %rdi
	callq	_ENGINE_READ
	movl	%eax, %r14d
	movq	_RING_TAIL@GOTPCREL(%rip), %rsi
	movq	%rbx, %rdi
	callq	_ENGINE_READ
	movl	%eax, %ecx
	xorl	%eax, %eax
	cmpl	%ecx, %r14d
	jne	LBB0_4
LBB0_3:
	movq	_RING_TAIL@GOTPCREL(%rip), %r14
	movq	%rbx, %rdi
	movq	%r14, %rsi
	callq	_ENGINE_READ
	movq	_RING_HEAD@GOTPCREL(%rip), %r15
	movq	%rbx, %rdi
	movq	%r15, %rsi
	movl	%eax, %edx
	callq	_ENGINE_WRITE
	movq	%rbx, %rdi
	movq	%r15, %rsi
	xorl	%edx, %edx
	callq	_ENGINE_WRITE
	movq	%rbx, %rdi
	movq	%r14, %rsi
	xorl	%edx, %edx
	callq	_ENGINE_WRITE
	movq	_RING_CTL@GOTPCREL(%rip), %rsi
	movq	%rbx, %rdi
	xorl	%edx, %edx
	callq	_ENGINE_WRITE
	movq	%rbx, %rdi
	movq	%r15, %rsi
	callq	_ENGINE_READ
	movl	%eax, %ecx
	movq	_HEAD_ADDR@GOTPCREL(%rip), %rdx
	xorl	%eax, %eax
	testl	%ecx, (%rdx)
	sete	%al
LBB0_4:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_STOP_RING,4,2                  ## @STOP_RING
	.comm	_MODE_IDLE,4,2                  ## @MODE_IDLE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"%s : timed out trying to stop ring\n"

	.comm	_HEAD_ADDR,4,2                  ## @HEAD_ADDR
	.no_dead_strip	_stop_ring
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function stop_ring
_stop_ring:                             ; @stop_ring
	.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	x19, x0
	ldr	x0, [x0, #16]
	bl	_INTEL_GEN
	cmp	w0, #3
	b.lt	LBB0_3
; %bb.1:
Lloh0:
	adrp	x8, _STOP_RING@GOTPAGE
Lloh1:
	ldr	x8, [x8, _STOP_RING@GOTPAGEOFF]
Lloh2:
	ldr	w0, [x8]
	bl	__MASKED_BIT_ENABLE
	mov	x2, x0
Lloh3:
	adrp	x1, _RING_MI_MODE@GOTPAGE
Lloh4:
	ldr	x1, [x1, _RING_MI_MODE@GOTPAGEOFF]
	mov	x0, x19
	bl	_ENGINE_WRITE
	ldp	w0, w20, [x19, #4]
	bl	_RING_MI_MODE
	mov	x1, x0
Lloh5:
	adrp	x8, _MODE_IDLE@GOTPAGE
Lloh6:
	ldr	x8, [x8, _MODE_IDLE@GOTPAGEOFF]
Lloh7:
	ldr	w2, [x8]
	mov	x0, x20
	mov	x3, x2
	mov	w4, #1000
	bl	_intel_wait_for_register
	cbz	x0, LBB0_3
; %bb.2:
	ldr	w1, [x19]
Lloh8:
	adrp	x0, l_.str@PAGE
Lloh9:
	add	x0, x0, l_.str@PAGEOFF
	bl	_DRM_ERROR
Lloh10:
	adrp	x1, _RING_HEAD@GOTPAGE
Lloh11:
	ldr	x1, [x1, _RING_HEAD@GOTPAGEOFF]
	mov	x0, x19
	bl	_ENGINE_READ
	mov	x20, x0
Lloh12:
	adrp	x1, _RING_TAIL@GOTPAGE
Lloh13:
	ldr	x1, [x1, _RING_TAIL@GOTPAGEOFF]
	mov	x0, x19
	bl	_ENGINE_READ
	cmp	w20, w0
	b.ne	LBB0_5
LBB0_3:
Lloh14:
	adrp	x20, _RING_TAIL@GOTPAGE
Lloh15:
	ldr	x20, [x20, _RING_TAIL@GOTPAGEOFF]
	mov	x0, x19
	mov	x1, x20
	bl	_ENGINE_READ
	mov	x2, x0
Lloh16:
	adrp	x21, _RING_HEAD@GOTPAGE
Lloh17:
	ldr	x21, [x21, _RING_HEAD@GOTPAGEOFF]
	mov	x0, x19
	mov	x1, x21
	bl	_ENGINE_WRITE
	mov	x0, x19
	mov	x1, x21
	mov	w2, #0
	bl	_ENGINE_WRITE
	mov	x0, x19
	mov	x1, x20
	mov	w2, #0
	bl	_ENGINE_WRITE
Lloh18:
	adrp	x1, _RING_CTL@GOTPAGE
Lloh19:
	ldr	x1, [x1, _RING_CTL@GOTPAGEOFF]
	mov	x0, x19
	mov	w2, #0
	bl	_ENGINE_WRITE
	mov	x0, x19
	mov	x1, x21
	bl	_ENGINE_READ
Lloh20:
	adrp	x8, _HEAD_ADDR@GOTPAGE
Lloh21:
	ldr	x8, [x8, _HEAD_ADDR@GOTPAGEOFF]
Lloh22:
	ldr	w8, [x8]
	tst	w8, w0
	cset	w0, eq
LBB0_4:
	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_5:
	mov	w0, #0
	b	LBB0_4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGot	Lloh18, Lloh19
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh14, Lloh15
	.cfi_endproc
                                        ; -- End function
	.comm	_STOP_RING,4,2                  ; @STOP_RING
	.comm	_MODE_IDLE,4,2                  ; @MODE_IDLE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"%s : timed out trying to stop ring\n"

	.comm	_HEAD_ADDR,4,2                  ; @HEAD_ADDR
	.no_dead_strip	_stop_ring
.subsections_via_symbols
