	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function hidma_handle_tre_completion
_hidma_handle_tre_completion:           ## @hidma_handle_tre_completion
	.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
	movl	(%rdi), %r14d
	movq	_HIDMA_EVCA_WRITE_PTR_REG@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	addq	16(%r15), %rdi
	callq	_readl_relaxed
	cmpl	%r14d, %eax
	jg	LBB0_10
## %bb.1:
	movl	%eax, %ebx
	movq	_HIDMA_EVRE_SIZE@GOTPCREL(%rip), %rcx
	cltd
	idivl	(%rcx)
	testl	%edx, %edx
	je	LBB0_2
LBB0_10:
	movl	24(%r15), %edi
	leaq	L_.str(%rip), %rsi
	callq	_dev_err
LBB0_8:
	xorl	%r13d, %r13d
LBB0_9:
	movl	%r13d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_2:
	movslq	4(%r15), %r12
	xorl	%r13d, %r13d
	leaq	(,%r12,4), %rax
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	.p2align	4, 0x90
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	cmpl	%ebx, %r12d
	je	LBB0_7
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	8(%r15), %rax
	addq	-48(%rbp), %rax                 ## 8-byte Folded Reload
	movq	_HIDMA_EVRE_CFG_IDX@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movl	(%rax,%rcx,4), %edx
	movq	_HIDMA_EVRE_ERRINFO_BIT_POS@GOTPCREL(%rip), %rax
	movzbl	(%rax), %ecx
	movl	%edx, %esi
	sarl	%cl, %esi
	movq	_HIDMA_EVRE_CODE_BIT_POS@GOTPCREL(%rip), %rax
	movzbl	(%rax), %ecx
	sarl	%cl, %edx
	movq	_HIDMA_EVRE_ERRINFO_MASK@GOTPCREL(%rip), %rax
	andl	(%rax), %esi
	movq	_HIDMA_EVRE_CODE_MASK@GOTPCREL(%rip), %rax
	andl	(%rax), %edx
	movq	%r15, %rdi
	callq	_hidma_post_completed
	testq	%rax, %rax
	jne	LBB0_7
## %bb.5:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	_HIDMA_EVRE_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%r12d, %edi
	movl	%r14d, %edx
	callq	_HIDMA_INCREMENT_ITERATOR
	movq	_HIDMA_EVCA_WRITE_PTR_REG@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	addq	16(%r15), %rdi
	callq	_readl_relaxed
	movl	%eax, %ebx
	movq	%r15, %rdi
	callq	_hidma_ll_isenabled
	decl	%r13d
	testl	%eax, %eax
	jne	LBB0_3
	jmp	LBB0_6
LBB0_7:
	testl	%r13d, %r13d
	je	LBB0_8
LBB0_6:
	negl	%r13d
	movq	_HIDMA_EVRE_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	imull	%r13d, %eax
	addl	4(%r15), %eax
	cltd
	idivl	%r14d
	movl	%edx, %ebx
	movq	_HIDMA_EVCA_DOORBELL_REG@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	16(%r15), %rsi
	movl	%edx, %edi
	callq	_writel
	movl	%ebx, 4(%r15)
	jmp	LBB0_9
	.cfi_endproc
                                        ## -- End function
	.comm	_HIDMA_EVCA_WRITE_PTR_REG,8,3   ## @HIDMA_EVCA_WRITE_PTR_REG
	.comm	_HIDMA_EVRE_SIZE,4,2            ## @HIDMA_EVRE_SIZE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"HW reports invalid EVRE write offset\n"

	.comm	_HIDMA_EVRE_CFG_IDX,8,3         ## @HIDMA_EVRE_CFG_IDX
	.comm	_HIDMA_EVRE_ERRINFO_BIT_POS,4,2 ## @HIDMA_EVRE_ERRINFO_BIT_POS
	.comm	_HIDMA_EVRE_ERRINFO_MASK,4,2    ## @HIDMA_EVRE_ERRINFO_MASK
	.comm	_HIDMA_EVRE_CODE_BIT_POS,4,2    ## @HIDMA_EVRE_CODE_BIT_POS
	.comm	_HIDMA_EVRE_CODE_MASK,4,2       ## @HIDMA_EVRE_CODE_MASK
	.comm	_HIDMA_EVCA_DOORBELL_REG,8,3    ## @HIDMA_EVCA_DOORBELL_REG
	.no_dead_strip	_hidma_handle_tre_completion
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function hidma_handle_tre_completion
_hidma_handle_tre_completion:           ; @hidma_handle_tre_completion
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x19, x0
	ldr	w20, [x0]
	ldr	x8, [x0, #16]
Lloh0:
	adrp	x24, _HIDMA_EVCA_WRITE_PTR_REG@GOTPAGE
Lloh1:
	ldr	x24, [x24, _HIDMA_EVCA_WRITE_PTR_REG@GOTPAGEOFF]
	ldr	x9, [x24]
	add	x0, x9, x8
	bl	_readl_relaxed
	cmp	w0, w20
	b.gt	LBB0_2
; %bb.1:
	mov	x22, x0
Lloh2:
	adrp	x23, _HIDMA_EVRE_SIZE@GOTPAGE
Lloh3:
	ldr	x23, [x23, _HIDMA_EVRE_SIZE@GOTPAGEOFF]
	ldr	w8, [x23]
	sdiv	w9, w0, w8
	msub	w8, w9, w8, w0
	cbz	w8, LBB0_5
LBB0_2:
	ldr	w0, [x19, #24]
Lloh4:
	adrp	x1, l_.str@PAGE
Lloh5:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
LBB0_3:
	mov	w21, #0
LBB0_4:
	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
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
LBB0_5:
	mov	w25, #0
	ldrsw	x21, [x19, #4]
Lloh6:
	adrp	x28, _HIDMA_EVRE_ERRINFO_MASK@GOTPAGE
Lloh7:
	ldr	x28, [x28, _HIDMA_EVRE_ERRINFO_MASK@GOTPAGEOFF]
Lloh8:
	adrp	x26, _HIDMA_EVRE_CODE_BIT_POS@GOTPAGE
Lloh9:
	ldr	x26, [x26, _HIDMA_EVRE_CODE_BIT_POS@GOTPAGEOFF]
Lloh10:
	adrp	x27, _HIDMA_EVRE_CODE_MASK@GOTPAGE
Lloh11:
	ldr	x27, [x27, _HIDMA_EVRE_CODE_MASK@GOTPAGEOFF]
LBB0_6:                                 ; =>This Inner Loop Header: Depth=1
	cmp	w21, w22
	b.eq	LBB0_9
; %bb.7:                                ;   in Loop: Header=BB0_6 Depth=1
	ldr	x8, [x19, #8]
	add	x8, x8, x21, lsl #2
Lloh12:
	adrp	x9, _HIDMA_EVRE_CFG_IDX@GOTPAGE
Lloh13:
	ldr	x9, [x9, _HIDMA_EVRE_CFG_IDX@GOTPAGEOFF]
Lloh14:
	ldr	x9, [x9]
	ldr	w8, [x8, x9, lsl #2]
Lloh15:
	adrp	x9, _HIDMA_EVRE_ERRINFO_BIT_POS@GOTPAGE
Lloh16:
	ldr	x9, [x9, _HIDMA_EVRE_ERRINFO_BIT_POS@GOTPAGEOFF]
Lloh17:
	ldr	w9, [x9]
	asr	w9, w8, w9
	ldr	w10, [x28]
	and	w1, w9, w10
	ldr	w9, [x26]
	asr	w8, w8, w9
	ldr	w9, [x27]
	and	w2, w8, w9
	mov	x0, x19
	bl	_hidma_post_completed
	cbnz	x0, LBB0_9
; %bb.8:                                ;   in Loop: Header=BB0_6 Depth=1
	ldr	w1, [x23]
	mov	x0, x21
	mov	x2, x20
	bl	_HIDMA_INCREMENT_ITERATOR
	ldr	x8, [x19, #16]
	ldr	x9, [x24]
	add	x0, x9, x8
	bl	_readl_relaxed
	mov	x22, x0
	mov	x0, x19
	bl	_hidma_ll_isenabled
	sub	w25, w25, #1
	cbnz	w0, LBB0_6
	b	LBB0_10
LBB0_9:
	cbz	w25, LBB0_3
LBB0_10:
	neg	w21, w25
	ldr	w8, [x19, #4]
	ldr	w9, [x23]
	madd	w8, w9, w21, w8
	sdiv	w9, w8, w20
	msub	w20, w9, w20, w8
	ldr	x8, [x19, #16]
Lloh18:
	adrp	x9, _HIDMA_EVCA_DOORBELL_REG@GOTPAGE
Lloh19:
	ldr	x9, [x9, _HIDMA_EVCA_DOORBELL_REG@GOTPAGEOFF]
Lloh20:
	ldr	x9, [x9]
	add	x1, x9, x8
	mov	x0, x20
	bl	_writel
	str	w20, [x19, #4]
	b	LBB0_4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.cfi_endproc
                                        ; -- End function
	.comm	_HIDMA_EVCA_WRITE_PTR_REG,8,3   ; @HIDMA_EVCA_WRITE_PTR_REG
	.comm	_HIDMA_EVRE_SIZE,4,2            ; @HIDMA_EVRE_SIZE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"HW reports invalid EVRE write offset\n"

	.comm	_HIDMA_EVRE_CFG_IDX,8,3         ; @HIDMA_EVRE_CFG_IDX
	.comm	_HIDMA_EVRE_ERRINFO_BIT_POS,4,2 ; @HIDMA_EVRE_ERRINFO_BIT_POS
	.comm	_HIDMA_EVRE_ERRINFO_MASK,4,2    ; @HIDMA_EVRE_ERRINFO_MASK
	.comm	_HIDMA_EVRE_CODE_BIT_POS,4,2    ; @HIDMA_EVRE_CODE_BIT_POS
	.comm	_HIDMA_EVRE_CODE_MASK,4,2       ; @HIDMA_EVRE_CODE_MASK
	.comm	_HIDMA_EVCA_DOORBELL_REG,8,3    ; @HIDMA_EVCA_DOORBELL_REG
	.no_dead_strip	_hidma_handle_tre_completion
.subsections_via_symbols
