	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_hns_rcb_wait_tx_ring_clean     ## -- Begin function hns_rcb_wait_tx_ring_clean
	.p2align	4, 0x90
_hns_rcb_wait_tx_ring_clean:            ## @hns_rcb_wait_tx_ring_clean
	.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, %rbx
	leaq	8(%rdi), %r15
	movq	_RCB_REG_TAIL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_dsaf_read_dev
	movq	_HNS_MAX_WAIT_CNT@GOTPCREL(%rip), %r12
	movl	(%r12), %ecx
	testl	%ecx, %ecx
	movq	%rbx, -48(%rbp)                 ## 8-byte Spill
	jle	LBB0_1
## %bb.2:
	movq	%rax, %r13
	movl	$1, %ebx
	movq	_RCB_REG_HEAD@GOTPCREL(%rip), %r14
	.p2align	4, 0x90
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	movl	(%r14), %esi
	movq	%r15, %rdi
	callq	_dsaf_read_dev
	cmpq	%rax, %r13
	je	LBB0_4
## %bb.5:                               ##   in Loop: Header=BB0_3 Depth=1
	movl	$100, %edi
	movl	$200, %esi
	callq	_usleep_range
	leal	1(%rbx), %edx
	movl	(%r12), %ecx
	cmpl	%ecx, %ebx
	movl	%edx, %ebx
	jl	LBB0_3
	jmp	LBB0_6
LBB0_1:
	movl	$1, %edx
	jmp	LBB0_6
LBB0_4:
	movl	(%r12), %ecx
	movl	%ebx, %edx
LBB0_6:
	xorl	%eax, %eax
	cmpl	%ecx, %edx
	jl	LBB0_8
## %bb.7:
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movq	(%rax), %rax
	movl	(%rax), %edi
	leaq	L_.str(%rip), %rsi
	callq	_dev_err
	movq	_EBUSY@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_8:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_RCB_REG_TAIL,4,2               ## @RCB_REG_TAIL
	.comm	_HNS_MAX_WAIT_CNT,4,2           ## @HNS_MAX_WAIT_CNT
	.comm	_RCB_REG_HEAD,4,2               ## @RCB_REG_HEAD
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"rcb wait timeout, head not equal to tail.\n"

	.comm	_EBUSY,4,2                      ## @EBUSY
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_hns_rcb_wait_tx_ring_clean     ; -- Begin function hns_rcb_wait_tx_ring_clean
	.p2align	2
_hns_rcb_wait_tx_ring_clean:            ; @hns_rcb_wait_tx_ring_clean
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	mov	x19, x0
	add	x20, x0, #8
Lloh0:
	adrp	x8, _RCB_REG_TAIL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _RCB_REG_TAIL@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_dsaf_read_dev
Lloh3:
	adrp	x23, _HNS_MAX_WAIT_CNT@GOTPAGE
Lloh4:
	ldr	x23, [x23, _HNS_MAX_WAIT_CNT@GOTPAGEOFF]
	ldr	w8, [x23]
	cmp	w8, #1
	b.lt	LBB0_5
; %bb.1:
	mov	x21, x0
	mov	w22, #1
Lloh5:
	adrp	x24, _RCB_REG_HEAD@GOTPAGE
Lloh6:
	ldr	x24, [x24, _RCB_REG_HEAD@GOTPAGEOFF]
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w1, [x24]
	mov	x0, x20
	bl	_dsaf_read_dev
	cmp	x21, x0
	b.eq	LBB0_7
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	mov	w0, #100
	mov	w1, #200
	bl	_usleep_range
	add	w9, w22, #1
	ldr	w8, [x23]
	cmp	w22, w8
	mov	x22, x9
	b.lt	LBB0_2
; %bb.4:
	mov	x22, x9
	cmp	w22, w8
	b.ge	LBB0_6
	b	LBB0_8
LBB0_5:
	mov	w22, #1
	cmp	w22, w8
	b.lt	LBB0_8
LBB0_6:
	ldr	x8, [x19]
	ldr	w0, [x8]
Lloh7:
	adrp	x1, l_.str@PAGE
Lloh8:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
Lloh9:
	adrp	x8, _EBUSY@GOTPAGE
Lloh10:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_9
LBB0_7:
	ldr	w8, [x23]
	cmp	w22, w8
	b.ge	LBB0_6
LBB0_8:
	mov	w0, #0
LBB0_9:
	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
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpAdd	Lloh7, Lloh8
	.cfi_endproc
                                        ; -- End function
	.comm	_RCB_REG_TAIL,4,2               ; @RCB_REG_TAIL
	.comm	_HNS_MAX_WAIT_CNT,4,2           ; @HNS_MAX_WAIT_CNT
	.comm	_RCB_REG_HEAD,4,2               ; @RCB_REG_HEAD
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"rcb wait timeout, head not equal to tail.\n"

	.comm	_EBUSY,4,2                      ; @EBUSY
.subsections_via_symbols
