	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_qib_user_sdma_queue_drain      ## -- Begin function qib_user_sdma_queue_drain
	.p2align	4, 0x90
_qib_user_sdma_queue_drain:             ## @qib_user_sdma_queue_drain
	.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
	subq	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	testq	%rsi, %rsi
	je	LBB0_8
## %bb.1:
	movq	%rsi, %rbx
	movq	%rdi, %r15
	movq	(%rdi), %rax
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	movq	_QIB_USER_SDMA_DRAIN_TIMEOUT@GOTPCREL(%rip), %r13
	cmpl	$0, (%r13)
	jle	LBB0_6
## %bb.2:
	leaq	4(%rbx), %r12
	xorl	%r14d, %r14d
	.p2align	4, 0x90
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	movq	%rbx, %rdi
	callq	_mutex_lock
	movq	%r12, %rdi
	callq	_list_empty
	testq	%rax, %rax
	jne	LBB0_4
## %bb.5:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	%r15, %rdi
	callq	_qib_user_sdma_hwqueue_clean
	movq	%r15, %rdi
	movq	%rbx, %rsi
	callq	_qib_user_sdma_queue_clean
	movq	%rbx, %rdi
	callq	_mutex_unlock
	movl	$10, %edi
	callq	_msleep
	incl	%r14d
	cmpl	(%r13), %r14d
	jl	LBB0_3
	jmp	LBB0_6
LBB0_4:
	movq	%rbx, %rdi
	callq	_mutex_unlock
LBB0_6:
	leaq	4(%rbx), %r15
	movq	%r15, %rdi
	callq	_list_empty
	testq	%rax, %rax
	jne	LBB0_8
## %bb.7:
	leaq	L_.str(%rip), %rsi
	movq	-48(%rbp), %r14                 ## 8-byte Reload
	movq	%r14, %rdi
	callq	_qib_dev_err
	leaq	-56(%rbp), %r12
	movq	%r12, %rdi
	callq	_INIT_LIST_HEAD
	movq	%rbx, %rdi
	callq	_mutex_lock
	movq	%r15, %rdi
	movq	%r12, %rsi
	callq	_list_splice_init
	movq	(%r14), %rdi
	movq	%rbx, %rsi
	movq	%r12, %rdx
	callq	_qib_user_sdma_free_pkt_list
	movq	%rbx, %rdi
	callq	_mutex_unlock
LBB0_8:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_QIB_USER_SDMA_DRAIN_TIMEOUT,4,2 ## @QIB_USER_SDMA_DRAIN_TIMEOUT
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"user sdma lists not empty: forcing!\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_qib_user_sdma_queue_drain      ; -- Begin function qib_user_sdma_queue_drain
	.p2align	2
_qib_user_sdma_queue_drain:             ; @qib_user_sdma_queue_drain
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	cbz	x1, LBB0_8
; %bb.1:
	mov	x19, x1
	mov	x21, x0
	ldr	x20, [x0]
Lloh0:
	adrp	x23, _QIB_USER_SDMA_DRAIN_TIMEOUT@GOTPAGE
Lloh1:
	ldr	x23, [x23, _QIB_USER_SDMA_DRAIN_TIMEOUT@GOTPAGEOFF]
	ldr	w8, [x23]
	cmp	w8, #1
	b.lt	LBB0_6
; %bb.2:
	mov	w24, #0
	add	x22, x19, #4
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x19
	bl	_mutex_lock
	mov	x0, x22
	bl	_list_empty
	cbnz	x0, LBB0_5
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	mov	x0, x21
	bl	_qib_user_sdma_hwqueue_clean
	mov	x0, x21
	mov	x1, x19
	bl	_qib_user_sdma_queue_clean
	mov	x0, x19
	bl	_mutex_unlock
	mov	w0, #10
	bl	_msleep
	add	w24, w24, #1
	ldr	w8, [x23]
	cmp	w24, w8
	b.lt	LBB0_3
	b	LBB0_6
LBB0_5:
	mov	x0, x19
	bl	_mutex_unlock
LBB0_6:
	add	x21, x19, #4
	mov	x0, x21
	bl	_list_empty
	cbnz	x0, LBB0_8
; %bb.7:
Lloh2:
	adrp	x1, l_.str@PAGE
Lloh3:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x20
	bl	_qib_dev_err
	add	x0, sp, #8
	bl	_INIT_LIST_HEAD
	mov	x0, x19
	bl	_mutex_lock
	add	x1, sp, #8
	mov	x0, x21
	bl	_list_splice_init
	ldr	x0, [x20]
	add	x2, sp, #8
	mov	x1, x19
	bl	_qib_user_sdma_free_pkt_list
	mov	x0, x19
	bl	_mutex_unlock
LBB0_8:
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.cfi_endproc
                                        ; -- End function
	.comm	_QIB_USER_SDMA_DRAIN_TIMEOUT,4,2 ; @QIB_USER_SDMA_DRAIN_TIMEOUT
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"user sdma lists not empty: forcing!\n"

.subsections_via_symbols
