	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal16,16byte_literals
	.p2align	4                               ## -- Begin function calc_avgy16
LCPI0_0:
	.long	0                               ## 0x0
	.long	1                               ## 0x1
	.long	2                               ## 0x2
	.long	3                               ## 0x3
LCPI0_1:
	.long	4                               ## 0x4
	.long	4                               ## 0x4
	.long	4                               ## 0x4
	.long	4                               ## 0x4
LCPI0_2:
	.long	8                               ## 0x8
	.long	8                               ## 0x8
	.long	8                               ## 0x8
	.long	8                               ## 0x8
LCPI0_3:
	.long	12                              ## 0xc
	.long	12                              ## 0xc
	.long	12                              ## 0xc
	.long	12                              ## 0xc
LCPI0_4:
	.long	16                              ## 0x10
	.long	16                              ## 0x10
	.long	16                              ## 0x10
	.long	16                              ## 0x10
	.section	__TEXT,__text,regular,pure_instructions
	.p2align	4, 0x90
_calc_avgy16:                           ## @calc_avgy16
	.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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r14
	movq	(%rdi), %r15
	movq	8(%rsi), %rax
	movq	(%rax), %rbx
	movq	(%r15), %rdi
	movb	8(%r15), %cl
	movl	$4, %edx
	shll	%cl, %edx
	xorl	%r12d, %r12d
	xorl	%esi, %esi
	callq	_memset
	movq	16(%r15), %r8
	movl	(%r8), %r9d
	testl	%r9d, %r9d
	jle	LBB0_7
## %bb.1:
	movq	24(%r15), %rdx
	movq	(%r14), %rsi
	movl	(%rdx), %edi
	jmp	LBB0_2
	.p2align	4, 0x90
LBB0_6:                                 ##   in Loop: Header=BB0_2 Depth=1
	movl	(%rsi), %eax
	movl	%eax, %ecx
	shrl	$31, %ecx
	addl	%eax, %ecx
	sarl	%ecx
	movslq	%ecx, %rax
	leaq	(%rbx,%rax,8), %rbx
	incl	%r12d
	cmpl	%r9d, %r12d
	jge	LBB0_7
LBB0_2:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_4 Depth 2
	testl	%edi, %edi
	jle	LBB0_6
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	(%r15), %rax
	xorl	%ecx, %ecx
	.p2align	4, 0x90
LBB0_4:                                 ##   Parent Loop BB0_2 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movq	(%rbx,%rcx,8), %rdi
	incl	(%rax,%rdi,4)
	incq	%rcx
	movslq	(%rdx), %rdi
	cmpq	%rdi, %rcx
	jl	LBB0_4
## %bb.5:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	(%r8), %r9d
	jmp	LBB0_6
LBB0_7:
	movl	8(%r15), %ecx
	pxor	%xmm0, %xmm0
	cmpl	$31, %ecx
	je	LBB0_19
## %bb.8:
	movl	$1, %esi
	movl	$1, %edx
                                        ## kill: def $cl killed $cl killed $ecx
	shll	%cl, %edx
	movq	(%r15), %rcx
	cmpl	$2, %edx
	cmovll	%esi, %edx
	cmpl	$8, %edx
	jae	LBB0_10
## %bb.9:
	xorl	%esi, %esi
	xorl	%edi, %edi
	jmp	LBB0_17
LBB0_10:
	movl	%edx, %esi
	andl	$2147483640, %esi               ## imm = 0x7FFFFFF8
	leaq	-8(%rsi), %rdi
	movq	%rdi, %r8
	shrq	$3, %r8
	incq	%r8
	testq	%rdi, %rdi
	je	LBB0_11
## %bb.12:
	movq	%r8, %rbx
	andq	$-2, %rbx
	movdqa	LCPI0_0(%rip), %xmm1            ## xmm1 = [0,1,2,3]
	pxor	%xmm0, %xmm0
	xorl	%edi, %edi
	movdqa	LCPI0_1(%rip), %xmm8            ## xmm8 = [4,4,4,4]
	movdqa	LCPI0_2(%rip), %xmm9            ## xmm9 = [8,8,8,8]
	movdqa	LCPI0_3(%rip), %xmm5            ## xmm5 = [12,12,12,12]
	movdqa	LCPI0_4(%rip), %xmm6            ## xmm6 = [16,16,16,16]
	pxor	%xmm2, %xmm2
	.p2align	4, 0x90
LBB0_13:                                ## =>This Inner Loop Header: Depth=1
	movdqa	%xmm1, %xmm7
	paddd	%xmm8, %xmm7
	movdqu	(%rcx,%rdi,4), %xmm3
	movdqu	16(%rcx,%rdi,4), %xmm4
	pmulld	%xmm7, %xmm4
	paddd	%xmm2, %xmm4
	movdqu	32(%rcx,%rdi,4), %xmm2
	movdqu	48(%rcx,%rdi,4), %xmm7
	pmulld	%xmm1, %xmm3
	paddd	%xmm0, %xmm3
	movdqa	%xmm1, %xmm0
	paddd	%xmm9, %xmm0
	pmulld	%xmm2, %xmm0
	paddd	%xmm3, %xmm0
	movdqa	%xmm1, %xmm2
	paddd	%xmm5, %xmm2
	pmulld	%xmm7, %xmm2
	paddd	%xmm4, %xmm2
	addq	$16, %rdi
	paddd	%xmm6, %xmm1
	addq	$-2, %rbx
	jne	LBB0_13
## %bb.14:
	testb	$1, %r8b
	je	LBB0_16
LBB0_15:
	movdqa	LCPI0_1(%rip), %xmm3            ## xmm3 = [4,4,4,4]
	paddd	%xmm1, %xmm3
	movdqu	(%rcx,%rdi,4), %xmm4
	movdqu	16(%rcx,%rdi,4), %xmm5
	pmulld	%xmm3, %xmm5
	paddd	%xmm5, %xmm2
	pmulld	%xmm1, %xmm4
	paddd	%xmm4, %xmm0
LBB0_16:
	paddd	%xmm2, %xmm0
	pshufd	$238, %xmm0, %xmm1              ## xmm1 = xmm0[2,3,2,3]
	paddd	%xmm0, %xmm1
	pshufd	$85, %xmm1, %xmm0               ## xmm0 = xmm1[1,1,1,1]
	paddd	%xmm1, %xmm0
	movd	%xmm0, %edi
	cmpq	%rdx, %rsi
	je	LBB0_18
	.p2align	4, 0x90
LBB0_17:                                ## =>This Inner Loop Header: Depth=1
	movl	(%rcx,%rsi,4), %eax
	imull	%esi, %eax
	addl	%eax, %edi
	incq	%rsi
	cmpq	%rsi, %rdx
	jne	LBB0_17
LBB0_18:
	xorps	%xmm0, %xmm0
	cvtsi2ss	%edi, %xmm0
LBB0_19:
	movq	24(%r15), %rax
	imull	(%rax), %r9d
	xorps	%xmm1, %xmm1
	cvtsi2ss	%r9d, %xmm1
	divss	%xmm1, %xmm0
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_11:
	movdqa	LCPI0_0(%rip), %xmm1            ## xmm1 = [0,1,2,3]
	pxor	%xmm0, %xmm0
	xorl	%edi, %edi
	pxor	%xmm2, %xmm2
	testb	$1, %r8b
	jne	LBB0_15
	jmp	LBB0_16
	.cfi_endproc
                                        ## -- End function
	.no_dead_strip	_calc_avgy16
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal16,16byte_literals
	.p2align	4                               ; -- Begin function calc_avgy16
lCPI0_0:
	.long	0                               ; 0x0
	.long	1                               ; 0x1
	.long	2                               ; 0x2
	.long	3                               ; 0x3
	.section	__TEXT,__text,regular,pure_instructions
	.p2align	2
_calc_avgy16:                           ; @calc_avgy16
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	mov	x19, x1
	ldr	x20, [x0]
	ldr	x8, [x1, #8]
	ldr	x21, [x8]
	ldr	x0, [x20]
	ldr	w8, [x20, #8]
	mov	w9, #4
	lsl	w2, w9, w8
	mov	w1, #0
	bl	_memset
	ldr	x9, [x20, #16]
	ldr	w8, [x9]
	cmp	w8, #1
	b.lt	LBB0_7
; %bb.1:
	mov	w10, #0
	ldr	x11, [x20, #24]
	ldr	x12, [x19]
	ldr	w13, [x11]
	b	LBB0_3
LBB0_2:                                 ;   in Loop: Header=BB0_3 Depth=1
	ldr	w14, [x12]
	cmp	w14, #0
	cinc	w14, w14, lt
	asr	w14, w14, #1
	add	x21, x21, w14, sxtw #3
	add	w10, w10, #1
	cmp	w10, w8
	b.ge	LBB0_7
LBB0_3:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_5 Depth 2
	cmp	w13, #1
	b.lt	LBB0_2
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	mov	x8, #0
	ldr	x14, [x20]
LBB0_5:                                 ;   Parent Loop BB0_3 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	x13, [x21, x8, lsl #3]
	lsl	x13, x13, #2
	ldr	w15, [x14, x13]
	add	w15, w15, #1
	str	w15, [x14, x13]
	add	x8, x8, #1
	ldrsw	x13, [x11]
	cmp	x8, x13
	b.lt	LBB0_5
; %bb.6:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	w8, [x9]
	b	LBB0_2
LBB0_7:
	ldr	w9, [x20, #8]
	movi	d0, #0000000000000000
	cmp	w9, #31
	b.eq	LBB0_15
; %bb.8:
	mov	w10, #1
	lsl	w10, w10, w9
	ldr	x9, [x20]
	cmp	w10, #1
	csinc	w10, w10, wzr, gt
	cmp	w10, #16
	b.hs	LBB0_10
; %bb.9:
	mov	x11, #0
	mov	w12, #0
	b	LBB0_13
LBB0_10:
	and	x11, x10, #0x7ffffff0
	movi.2d	v0, #0000000000000000
	movi.4s	v1, #4
Lloh0:
	adrp	x12, lCPI0_0@PAGE
Lloh1:
	ldr	q2, [x12, lCPI0_0@PAGEOFF]
	add	x12, x9, #32
	movi.4s	v3, #8
	movi.4s	v4, #12
	movi.4s	v5, #16
	mov	x13, x11
	movi.2d	v6, #0000000000000000
	movi.2d	v7, #0000000000000000
	movi.2d	v16, #0000000000000000
LBB0_11:                                ; =>This Inner Loop Header: Depth=1
	add.4s	v17, v2, v1
	add.4s	v18, v2, v3
	add.4s	v19, v2, v4
	ldp	q20, q21, [x12, #-32]
	ldp	q22, q23, [x12], #64
	mla.4s	v0, v20, v2
	mla.4s	v6, v21, v17
	mla.4s	v7, v22, v18
	mla.4s	v16, v23, v19
	add.4s	v2, v2, v5
	subs	x13, x13, #16
	b.ne	LBB0_11
; %bb.12:
	add.4s	v0, v6, v0
	add.4s	v0, v7, v0
	add.4s	v0, v16, v0
	addv.4s	s0, v0
	fmov	w12, s0
	cmp	x11, x10
	b.eq	LBB0_14
LBB0_13:                                ; =>This Inner Loop Header: Depth=1
	ldr	w13, [x9, x11, lsl #2]
	madd	w12, w13, w11, w12
	add	x11, x11, #1
	cmp	x10, x11
	b.ne	LBB0_13
LBB0_14:
	scvtf	s0, w12
LBB0_15:
	ldr	x9, [x20, #24]
	ldr	w9, [x9]
	mul	w8, w9, w8
	scvtf	s1, w8
	fdiv	s0, s0, s1
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpLdr	Lloh0, Lloh1
	.cfi_endproc
                                        ; -- End function
	.no_dead_strip	_calc_avgy16
.subsections_via_symbols
