	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function sbefifo_cleanup_hw
_sbefifo_cleanup_hw:                    ## @sbefifo_cleanup_hw
	.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	%rdi, %r15
	movq	8(%rdi), %r14
	callq	_sbefifo_check_sbe_state
	testl	%eax, %eax
	je	LBB0_2
## %bb.1:
	movl	%eax, %ebx
	leaq	L_.str(%rip), %rsi
	movq	%r14, %rdi
	movl	%eax, %edx
	callq	_dev_dbg
	jmp	LBB0_16
LBB0_2:
	cmpl	$0, (%r15)
	je	LBB0_3
LBB0_15:
	movq	%r15, %rdi
	callq	_sbefifo_request_reset
	movl	%eax, %ebx
	jmp	LBB0_16
LBB0_3:
	movq	_SBEFIFO_UP@GOTPCREL(%rip), %r12
	movq	_SBEFIFO_STS@GOTPCREL(%rip), %r13
	movl	(%r13), %esi
	orl	(%r12), %esi
	leaq	-48(%rbp), %rdx
	movq	%r15, %rdi
	callq	_sbefifo_regr
	testl	%eax, %eax
	je	LBB0_6
## %bb.4:
	movl	%eax, %ebx
	leaq	L_.str.1(%rip), %rsi
	jmp	LBB0_5
LBB0_6:
	movq	_SBEFIFO_DOWN@GOTPCREL(%rip), %rax
	movl	(%r13), %esi
	orl	(%rax), %esi
	leaq	-44(%rbp), %rdx
	movq	%r15, %rdi
	callq	_sbefifo_regr
	testl	%eax, %eax
	je	LBB0_8
## %bb.7:
	movl	%eax, %ebx
	leaq	L_.str.2(%rip), %rsi
LBB0_5:
	movq	%r14, %rdi
	movl	%ebx, %edx
	callq	_dev_err
	movl	$1, (%r15)
LBB0_16:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_8:
	movl	-44(%rbp), %ecx
	movq	_SBEFIFO_STS_RESET_REQ@GOTPCREL(%rip), %rax
	testl	%ecx, (%rax)
	je	LBB0_12
## %bb.9:
	leaq	L_.str.3(%rip), %rsi
	xorl	%ebx, %ebx
	movq	%r14, %rdi
	xorl	%eax, %eax
	callq	_dev_info
	movl	(%r12), %esi
	movq	_SBEFIFO_PERFORM_RESET@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r15, %rdi
	callq	_sbefifo_regw
	testl	%eax, %eax
	je	LBB0_11
## %bb.10:
	movl	%eax, %r12d
	movl	$1, (%r15)
	leaq	L_.str.4(%rip), %rsi
	movq	%r14, %rdi
	movl	%eax, %edx
	callq	_dev_err
	movl	%r12d, %ebx
	jmp	LBB0_16
LBB0_12:
	movl	-48(%rbp), %edx
	movl	%edx, %eax
	andl	%ecx, %eax
	movq	_SBEFIFO_STS_EMPTY@GOTPCREL(%rip), %rsi
	testl	%eax, (%rsi)
	je	LBB0_14
## %bb.13:
	movl	%edx, %eax
	orl	%ecx, %eax
	movq	_SBEFIFO_STS_PARITY_ERR@GOTPCREL(%rip), %rsi
	xorl	%ebx, %ebx
	andl	(%rsi), %eax
	je	LBB0_16
LBB0_14:
	leaq	L_.str.5(%rip), %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	callq	_dev_info
	jmp	LBB0_15
LBB0_11:
	movl	$0, (%r15)
	jmp	LBB0_16
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"SBE state=%d\n"

	.comm	_SBEFIFO_UP,4,2                 ## @SBEFIFO_UP
	.comm	_SBEFIFO_STS,4,2                ## @SBEFIFO_STS
L_.str.1:                               ## @.str.1
	.asciz	"Cleanup: Reading UP status failed, rc=%d\n"

	.comm	_SBEFIFO_DOWN,4,2               ## @SBEFIFO_DOWN
L_.str.2:                               ## @.str.2
	.asciz	"Cleanup: Reading DOWN status failed, rc=%d\n"

	.comm	_SBEFIFO_STS_RESET_REQ,4,2      ## @SBEFIFO_STS_RESET_REQ
L_.str.3:                               ## @.str.3
	.asciz	"Cleanup: FIFO reset request set, resetting\n"

	.comm	_SBEFIFO_PERFORM_RESET,4,2      ## @SBEFIFO_PERFORM_RESET
L_.str.4:                               ## @.str.4
	.asciz	"Cleanup: Reset reg write failed, rc=%d\n"

	.comm	_SBEFIFO_STS_PARITY_ERR,4,2     ## @SBEFIFO_STS_PARITY_ERR
	.comm	_SBEFIFO_STS_EMPTY,4,2          ## @SBEFIFO_STS_EMPTY
L_.str.5:                               ## @.str.5
	.asciz	"Cleanup: FIFO not clean (up=0x%08x down=0x%08x)\n"

	.no_dead_strip	_sbefifo_cleanup_hw
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function sbefifo_cleanup_hw
_sbefifo_cleanup_hw:                    ; @sbefifo_cleanup_hw
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	mov	x19, x0
	ldr	x20, [x0, #8]
	bl	_sbefifo_check_sbe_state
	cbz	w0, LBB0_2
; %bb.1:
	mov	x21, x0
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x20
	mov	x2, x21
	bl	_dev_dbg
	b	LBB0_9
LBB0_2:
	ldr	w8, [x19]
	cbz	w8, LBB0_4
LBB0_3:
	mov	x0, x19
	bl	_sbefifo_request_reset
	mov	x21, x0
	b	LBB0_9
LBB0_4:
Lloh2:
	adrp	x22, _SBEFIFO_UP@GOTPAGE
Lloh3:
	ldr	x22, [x22, _SBEFIFO_UP@GOTPAGEOFF]
	ldr	w8, [x22]
Lloh4:
	adrp	x23, _SBEFIFO_STS@GOTPAGE
Lloh5:
	ldr	x23, [x23, _SBEFIFO_STS@GOTPAGEOFF]
	ldr	w9, [x23]
	orr	w1, w9, w8
	add	x2, sp, #28
	mov	x0, x19
	bl	_sbefifo_regr
	cbz	w0, LBB0_6
; %bb.5:
	mov	x21, x0
Lloh6:
	adrp	x1, l_.str.1@PAGE
Lloh7:
	add	x1, x1, l_.str.1@PAGEOFF
	b	LBB0_8
LBB0_6:
Lloh8:
	adrp	x8, _SBEFIFO_DOWN@GOTPAGE
Lloh9:
	ldr	x8, [x8, _SBEFIFO_DOWN@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
	ldr	w9, [x23]
	orr	w1, w9, w8
	add	x2, sp, #24
	mov	x0, x19
	bl	_sbefifo_regr
	cbz	w0, LBB0_10
; %bb.7:
	mov	x21, x0
Lloh11:
	adrp	x1, l_.str.2@PAGE
Lloh12:
	add	x1, x1, l_.str.2@PAGEOFF
LBB0_8:
	mov	x0, x20
	mov	x2, x21
	bl	_dev_err
	mov	w8, #1
	str	w8, [x19]
LBB0_9:
	mov	x0, x21
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
LBB0_10:
	ldr	w8, [sp, #24]
Lloh13:
	adrp	x9, _SBEFIFO_STS_RESET_REQ@GOTPAGE
Lloh14:
	ldr	x9, [x9, _SBEFIFO_STS_RESET_REQ@GOTPAGEOFF]
Lloh15:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_13
; %bb.11:
Lloh16:
	adrp	x1, l_.str.3@PAGE
Lloh17:
	add	x1, x1, l_.str.3@PAGEOFF
	mov	x0, x20
	bl	_dev_info
	ldr	w1, [x22]
Lloh18:
	adrp	x8, _SBEFIFO_PERFORM_RESET@GOTPAGE
Lloh19:
	ldr	x8, [x8, _SBEFIFO_PERFORM_RESET@GOTPAGEOFF]
Lloh20:
	ldr	w2, [x8]
	mov	x0, x19
	bl	_sbefifo_regw
	mov	x21, x0
	cbz	w0, LBB0_15
; %bb.12:
	mov	w8, #1
	str	w8, [x19]
Lloh21:
	adrp	x1, l_.str.4@PAGE
Lloh22:
	add	x1, x1, l_.str.4@PAGEOFF
	mov	x0, x20
	mov	x2, x21
	bl	_dev_err
	b	LBB0_9
LBB0_13:
	ldr	w9, [sp, #28]
	orr	w10, w9, w8
Lloh23:
	adrp	x11, _SBEFIFO_STS_PARITY_ERR@GOTPAGE
Lloh24:
	ldr	x11, [x11, _SBEFIFO_STS_PARITY_ERR@GOTPAGEOFF]
Lloh25:
	ldr	w11, [x11]
	and	w10, w10, w11
	and	w11, w9, w8
Lloh26:
	adrp	x12, _SBEFIFO_STS_EMPTY@GOTPAGE
Lloh27:
	ldr	x12, [x12, _SBEFIFO_STS_EMPTY@GOTPAGEOFF]
Lloh28:
	ldr	w12, [x12]
	and	w11, w11, w12
	cmp	w11, #0
	ccmp	w10, #0, #0, ne
	b.eq	LBB0_16
; %bb.14:
	stp	x9, x8, [sp]
Lloh29:
	adrp	x1, l_.str.5@PAGE
Lloh30:
	add	x1, x1, l_.str.5@PAGEOFF
	mov	x0, x20
	bl	_dev_info
	b	LBB0_3
LBB0_15:
	str	wzr, [x19]
	b	LBB0_9
LBB0_16:
	mov	w21, #0
	b	LBB0_9
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpAdd	Lloh29, Lloh30
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"SBE state=%d\n"

	.comm	_SBEFIFO_UP,4,2                 ; @SBEFIFO_UP
	.comm	_SBEFIFO_STS,4,2                ; @SBEFIFO_STS
l_.str.1:                               ; @.str.1
	.asciz	"Cleanup: Reading UP status failed, rc=%d\n"

	.comm	_SBEFIFO_DOWN,4,2               ; @SBEFIFO_DOWN
l_.str.2:                               ; @.str.2
	.asciz	"Cleanup: Reading DOWN status failed, rc=%d\n"

	.comm	_SBEFIFO_STS_RESET_REQ,4,2      ; @SBEFIFO_STS_RESET_REQ
l_.str.3:                               ; @.str.3
	.asciz	"Cleanup: FIFO reset request set, resetting\n"

	.comm	_SBEFIFO_PERFORM_RESET,4,2      ; @SBEFIFO_PERFORM_RESET
l_.str.4:                               ; @.str.4
	.asciz	"Cleanup: Reset reg write failed, rc=%d\n"

	.comm	_SBEFIFO_STS_PARITY_ERR,4,2     ; @SBEFIFO_STS_PARITY_ERR
	.comm	_SBEFIFO_STS_EMPTY,4,2          ; @SBEFIFO_STS_EMPTY
l_.str.5:                               ; @.str.5
	.asciz	"Cleanup: FIFO not clean (up=0x%08x down=0x%08x)\n"

	.no_dead_strip	_sbefifo_cleanup_hw
.subsections_via_symbols
