	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function flexrm_process_completions
_flexrm_process_completions:            ## @flexrm_process_completions
	.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	$56, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r15
	movq	(%rdi), %rcx
	movq	24(%rdi), %rax
	shlq	$2, %rcx
	addq	8(%rax), %rcx
	movq	%rcx, -88(%rbp)                 ## 8-byte Spill
	leaq	32(%rdi), %rbx
	movq	%rbx, %rdi
	callq	_spin_lock_irqsave
	movq	_RING_CMPL_WRITE_PTR@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	addq	56(%r15), %rdi
	callq	_readl_relaxed
	movq	%rax, %r12
	movq	_RING_DESC_SIZE@GOTPCREL(%rip), %rax
	imulq	(%rax), %r12
	movq	8(%r15), %r14
	movq	%r12, 8(%r15)
	movq	%rbx, -80(%rbp)                 ## 8-byte Spill
	movq	%rbx, %rdi
	callq	_spin_unlock_irqrestore
	xorl	%eax, %eax
	movq	%r12, -56(%rbp)                 ## 8-byte Spill
	cmpq	%r12, %r14
	je	LBB0_11
## %bb.1:
	leaq	16(%r15), %rax
	movq	%rax, -72(%rbp)                 ## 8-byte Spill
	xorl	%eax, %eax
LBB0_2:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_3 Depth 2
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movq	%r14, %rax
	.p2align	4, 0x90
LBB0_3:                                 ##   Parent Loop BB0_2 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movq	_RING_DESC_SIZE@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rdx
	addq	%rax, %rdx
	movq	_RING_CMPL_SIZE@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rdx
	jne	LBB0_5
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=2
	xorl	%edx, %edx
LBB0_5:                                 ##   in Loop: Header=BB0_3 Depth=2
	movq	%rdx, -64(%rbp)                 ## 8-byte Spill
	movq	48(%r15), %rcx
	movq	(%rcx,%rax), %r13
	movq	%r13, %rdi
	callq	_flexrm_cmpl_desc_to_error
	movl	%eax, %r14d
	testl	%eax, %eax
	jns	LBB0_7
## %bb.6:                               ##   in Loop: Header=BB0_3 Depth=2
	movq	(%r15), %rdx
	movq	24(%r15), %rax
	movl	(%rax), %edi
	leaq	L_.str(%rip), %rsi
	movq	%r13, %rcx
	movl	%r14d, %r8d
	xorl	%eax, %eax
	callq	_dev_warn
LBB0_7:                                 ##   in Loop: Header=BB0_3 Depth=2
	movq	%r13, %rdi
	callq	_flexrm_cmpl_desc_to_reqid
	movq	%rax, %r12
	movq	40(%r15), %rax
	movq	%r15, %rbx
	movq	(%rax,%r12,8), %r15
	testq	%r15, %r15
	jne	LBB0_10
## %bb.8:                               ##   in Loop: Header=BB0_3 Depth=2
	movq	(%rbx), %rdx
	movq	24(%rbx), %rax
	movl	(%rax), %edi
	leaq	L_.str.1(%rip), %rsi
	movq	%r13, %rcx
	xorl	%eax, %eax
	callq	_dev_warn
	movq	-64(%rbp), %rcx                 ## 8-byte Reload
	movq	%rcx, %rax
	cmpq	-56(%rbp), %rcx                 ## 8-byte Folded Reload
	movq	%rbx, %r15
	jne	LBB0_3
	jmp	LBB0_9
	.p2align	4, 0x90
LBB0_10:                                ##   in Loop: Header=BB0_2 Depth=1
	movq	$0, (%rax,%r12,8)
	movq	-80(%rbp), %r13                 ## 8-byte Reload
	movq	%r13, %rdi
	callq	_spin_lock_irqsave
	movl	36(%rbx), %edi
	movq	%r12, %rsi
	xorl	%edx, %edx
	callq	_bitmap_release_region
	movq	%r13, %rdi
	callq	_spin_unlock_irqrestore
	movq	24(%rbx), %rax
	movl	(%rax), %edi
	movq	%r15, %rsi
	callq	_flexrm_dma_unmap
	movl	%r14d, (%r15)
	movq	-88(%rbp), %rdi                 ## 8-byte Reload
	movq	%r15, %rsi
	callq	_mbox_chan_received_data
	movq	-72(%rbp), %rdi                 ## 8-byte Reload
	callq	_atomic_inc_return
	movl	-44(%rbp), %eax                 ## 4-byte Reload
	incl	%eax
	movq	-64(%rbp), %r14                 ## 8-byte Reload
	cmpq	-56(%rbp), %r14                 ## 8-byte Folded Reload
	movq	%rbx, %r15
	jne	LBB0_2
	jmp	LBB0_11
LBB0_9:
	movl	-44(%rbp), %eax                 ## 4-byte Reload
LBB0_11:
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_RING_CMPL_WRITE_PTR,8,3        ## @RING_CMPL_WRITE_PTR
	.comm	_RING_DESC_SIZE,8,3             ## @RING_DESC_SIZE
	.comm	_RING_CMPL_SIZE,8,3             ## @RING_CMPL_SIZE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"ring%d got completion desc=0x%lx with error %d\n"

L_.str.1:                               ## @.str.1
	.asciz	"ring%d null msg pointer for completion desc=0x%lx\n"

	.no_dead_strip	_flexrm_process_completions
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function flexrm_process_completions
_flexrm_process_completions:            ; @flexrm_process_completions
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #144
	.cfi_def_cfa_offset 144
	stp	x28, x27, [sp, #48]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #64]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #80]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #96]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #112]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #128]            ; 16-byte Folded Spill
	add	x29, sp, #128
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x19, x0
	ldr	x8, [x0, #24]
	ldr	x21, [x8, #8]
	ldr	x22, [x0]
	add	x25, x0, #32
	mov	x0, x25
	bl	_spin_lock_irqsave
	ldr	x8, [x19, #56]
Lloh0:
	adrp	x9, _RING_CMPL_WRITE_PTR@GOTPAGE
Lloh1:
	ldr	x9, [x9, _RING_CMPL_WRITE_PTR@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	add	x0, x9, x8
	bl	_readl_relaxed
Lloh3:
	adrp	x23, _RING_DESC_SIZE@GOTPAGE
Lloh4:
	ldr	x23, [x23, _RING_DESC_SIZE@GOTPAGEOFF]
	ldr	x8, [x23]
	mul	x20, x8, x0
	ldr	x24, [x19, #8]
	str	x20, [x19, #8]
	str	x25, [sp, #32]                  ; 8-byte Folded Spill
	mov	x0, x25
	bl	_spin_unlock_irqrestore
	cmp	x24, x20
	b.ne	LBB0_2
; %bb.1:
	mov	w0, #0
	b	LBB0_10
LBB0_2:
	mov	w0, #0
	add	x9, x21, x22, lsl #2
	add	x8, x19, #16
	stp	x8, x9, [sp, #16]               ; 16-byte Folded Spill
Lloh5:
	adrp	x21, _RING_CMPL_SIZE@GOTPAGE
Lloh6:
	ldr	x21, [x21, _RING_CMPL_SIZE@GOTPAGEOFF]
Lloh7:
	adrp	x25, l_.str.1@PAGE
Lloh8:
	add	x25, x25, l_.str.1@PAGEOFF
LBB0_3:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_4 Depth 2
	str	w0, [sp, #44]                   ; 4-byte Folded Spill
LBB0_4:                                 ;   Parent Loop BB0_3 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	x8, [x19, #48]
	ldr	x27, [x8, x24]
	ldr	x8, [x23]
	ldr	x9, [x21]
	add	x8, x8, x24
	cmp	x8, x9
	csel	x24, xzr, x8, eq
	mov	x0, x27
	bl	_flexrm_cmpl_desc_to_error
	mov	x26, x0
	tbz	w0, #31, LBB0_6
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=2
	ldr	x8, [x19, #24]
	ldr	w0, [x8]
	ldr	x2, [x19]
	str	x26, [sp]
Lloh9:
	adrp	x1, l_.str@PAGE
Lloh10:
	add	x1, x1, l_.str@PAGEOFF
	mov	x3, x27
	bl	_dev_warn
LBB0_6:                                 ;   in Loop: Header=BB0_4 Depth=2
	mov	x0, x27
	bl	_flexrm_cmpl_desc_to_reqid
	ldr	x8, [x19, #40]
	ldr	x28, [x8, x0, lsl #3]
	cbnz	x28, LBB0_8
; %bb.7:                                ;   in Loop: Header=BB0_4 Depth=2
	ldr	x8, [x19, #24]
	ldr	w0, [x8]
	ldr	x2, [x19]
	mov	x1, x25
	mov	x3, x27
	bl	_dev_warn
	cmp	x24, x20
	b.ne	LBB0_4
	b	LBB0_9
LBB0_8:                                 ;   in Loop: Header=BB0_3 Depth=1
	mov	x22, x0
	str	xzr, [x8, x0, lsl #3]
	ldr	x27, [sp, #32]                  ; 8-byte Folded Reload
	mov	x0, x27
	bl	_spin_lock_irqsave
	ldr	w0, [x19, #36]
	mov	x1, x22
	mov	w2, #0
	bl	_bitmap_release_region
	mov	x0, x27
	bl	_spin_unlock_irqrestore
	ldr	x8, [x19, #24]
	ldr	w0, [x8]
	mov	x1, x28
	bl	_flexrm_dma_unmap
	str	w26, [x28]
	ldr	x0, [sp, #24]                   ; 8-byte Folded Reload
	mov	x1, x28
	bl	_mbox_chan_received_data
	ldr	x0, [sp, #16]                   ; 8-byte Folded Reload
	bl	_atomic_inc_return
	ldr	w0, [sp, #44]                   ; 4-byte Folded Reload
	add	w0, w0, #1
	cmp	x24, x20
	b.ne	LBB0_3
	b	LBB0_10
LBB0_9:
	ldr	w0, [sp, #44]                   ; 4-byte Folded Reload
LBB0_10:
	ldp	x29, x30, [sp, #128]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #112]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #96]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #80]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #64]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #48]             ; 16-byte Folded Reload
	add	sp, sp, #144
	ret
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpAdd	Lloh9, Lloh10
	.cfi_endproc
                                        ; -- End function
	.comm	_RING_CMPL_WRITE_PTR,8,3        ; @RING_CMPL_WRITE_PTR
	.comm	_RING_DESC_SIZE,8,3             ; @RING_DESC_SIZE
	.comm	_RING_CMPL_SIZE,8,3             ; @RING_CMPL_SIZE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"ring%d got completion desc=0x%lx with error %d\n"

l_.str.1:                               ; @.str.1
	.asciz	"ring%d null msg pointer for completion desc=0x%lx\n"

	.no_dead_strip	_flexrm_process_completions
.subsections_via_symbols
