	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function average_quantized_coeffs
_average_quantized_coeffs:              ## @average_quantized_coeffs
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r15
	movq	_coeff_per_sb_for_avg@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	(%rdi), %rcx
	movq	(%rax,%rcx,8), %r14
	movl	24(%rdi), %edi
	callq	_QDM2_SB_USED
	movl	8(%r15), %esi
	testl	%esi, %esi
	jle	LBB0_7
## %bb.1:
	cltq
	movl	-4(%r14,%rax,4), %r8d
	leal	1(%r8), %r10d
	xorl	%r9d, %r9d
	jmp	LBB0_2
	.p2align	4, 0x90
LBB0_6:                                 ##   in Loop: Header=BB0_2 Depth=1
	incq	%r9
	movslq	%esi, %rax
	cmpq	%rax, %r9
	jge	LBB0_7
LBB0_2:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_4 Depth 2
	testl	%r8d, %r8d
	js	LBB0_6
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	16(%r15), %rax
	movq	(%rax,%r9,8), %rsi
	xorl	%edi, %edi
	.p2align	4, 0x90
LBB0_4:                                 ##   Parent Loop BB0_2 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movq	(%rsi,%rdi,8), %rax
	movdqu	(%rax), %xmm0
	movdqu	16(%rax), %xmm1
	paddd	%xmm0, %xmm1
	pshufd	$238, %xmm1, %xmm0              ## xmm0 = xmm1[2,3,2,3]
	paddd	%xmm1, %xmm0
	pshufd	$85, %xmm0, %xmm1               ## xmm1 = xmm0[1,1,1,1]
	paddd	%xmm0, %xmm1
	movd	%xmm1, %ebx
	leal	7(%rbx), %edx
	testl	%ebx, %ebx
	cmovnsl	%ebx, %edx
	sarl	$3, %edx
	xorl	%ecx, %ecx
	cmpl	$8, %ebx
	setge	%cl
	subl	%ecx, %edx
	movd	%edx, %xmm0
	pshufd	$0, %xmm0, %xmm0                ## xmm0 = xmm0[0,0,0,0]
	movdqu	%xmm0, (%rax)
	movdqu	%xmm0, 16(%rax)
	incq	%rdi
	cmpq	%rdi, %r10
	jne	LBB0_4
## %bb.5:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	8(%r15), %esi
	jmp	LBB0_6
LBB0_7:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_coeff_per_sb_for_avg,8,3       ## @coeff_per_sb_for_avg
	.no_dead_strip	_average_quantized_coeffs
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function average_quantized_coeffs
_average_quantized_coeffs:              ; @average_quantized_coeffs
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	mov	x19, x0
Lloh0:
	adrp	x8, _coeff_per_sb_for_avg@GOTPAGE
Lloh1:
	ldr	x8, [x8, _coeff_per_sb_for_avg@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	ldr	x9, [x0]
	ldr	x20, [x8, x9, lsl #3]
	ldr	w0, [x0, #24]
	bl	_QDM2_SB_USED
	ldr	w11, [x19, #8]
	cmp	w11, #1
	b.lt	LBB0_7
; %bb.1:
	mov	x8, #0
	sub	w9, w0, #1
	ldr	w9, [x20, w9, sxtw #2]
	add	w10, w9, #1
	b	LBB0_3
LBB0_2:                                 ;   in Loop: Header=BB0_3 Depth=1
	add	x8, x8, #1
	cmp	x8, w11, sxtw
	b.ge	LBB0_7
LBB0_3:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_5 Depth 2
	tbnz	w9, #31, LBB0_2
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	x11, [x19, #16]
	ldr	x11, [x11, x8, lsl #3]
	mov	x12, x10
LBB0_5:                                 ;   Parent Loop BB0_3 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	x13, [x11], #8
	ldp	q1, q0, [x13]
	add.4s	v0, v1, v0
	addv.4s	s0, v0
	fmov	w14, s0
	add	w15, w14, #7
	cmp	w14, #0
	csel	w15, w15, w14, lt
	asr	w15, w15, #3
	cmp	w14, #7
	cset	w14, gt
	sub	w14, w15, w14
	dup.4s	v0, w14
	stp	q0, q0, [x13]
	subs	x12, x12, #1
	b.ne	LBB0_5
; %bb.6:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	w11, [x19, #8]
	b	LBB0_2
LBB0_7:
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_coeff_per_sb_for_avg,8,3       ; @coeff_per_sb_for_avg
	.no_dead_strip	_average_quantized_coeffs
.subsections_via_symbols
