	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function rematrix_channels
_rematrix_channels:                     ## @rematrix_channels
	.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
	movq	24(%rdi), %r14
	cmpl	$0, (%r14)
	je	LBB0_17
## %bb.1:
	movq	%rdi, %r15
	movl	8(%rdi), %r12d
	movl	%r12d, %r10d
	andl	$-8, %r10d
	leaq	-8(%r10), %rax
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	movq	%rax, %rcx
	shrq	$3, %rcx
	incq	%rcx
	movq	%rcx, %rax
	movq	%rcx, -56(%rbp)                 ## 8-byte Spill
	andq	$-2, %rcx
	movq	%rcx, -48(%rbp)                 ## 8-byte Spill
	xorl	%r13d, %r13d
	jmp	LBB0_2
	.p2align	4, 0x90
LBB0_16:                                ##   in Loop: Header=BB0_2 Depth=1
	incq	%r13
	movl	(%r14), %eax
	cmpq	%rax, %r13
	jae	LBB0_17
LBB0_2:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_4 Depth 2
                                        ##       Child Loop BB0_10 Depth 3
                                        ##       Child Loop BB0_14 Depth 3
	movq	16(%r15), %rax
	movq	(%rax), %rax
	xorl	%edi, %edi
	movq	_AV_SAMPLE_FMT_S16@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	sete	%dil
	shll	$3, %edi
	movq	8(%r14), %rax
	subl	(%rax,%r13,4), %edi
	movq	%r10, %rbx
	callq	_MSB_MASK
	movq	%rbx, %r10
	cmpl	$0, 12(%r15)
	je	LBB0_16
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	(%r15), %rcx
	movq	16(%r14), %rdx
	movl	(%rdx,%r13,4), %r8d
	xorl	%r9d, %r9d
	jmp	LBB0_4
	.p2align	4, 0x90
LBB0_15:                                ##   in Loop: Header=BB0_4 Depth=2
	sarl	$14, %edx
	andl	%eax, %edx
	movl	%edx, (%rcx,%r8,4)
	movl	8(%r15), %edx
	leaq	(%rcx,%rdx,4), %rcx
	incl	%r9d
	cmpl	12(%r15), %r9d
	jae	LBB0_16
LBB0_4:                                 ##   Parent Loop BB0_2 Depth=1
                                        ## =>  This Loop Header: Depth=2
                                        ##       Child Loop BB0_10 Depth 3
                                        ##       Child Loop BB0_14 Depth 3
	movl	$0, %edx
	testq	%r12, %r12
	je	LBB0_15
## %bb.5:                               ##   in Loop: Header=BB0_4 Depth=2
	movq	24(%r14), %rdx
	movq	(%rdx,%r13,8), %rdi
	cmpl	$8, %r12d
	jae	LBB0_7
## %bb.6:                               ##   in Loop: Header=BB0_4 Depth=2
	xorl	%esi, %esi
	xorl	%edx, %edx
	jmp	LBB0_14
	.p2align	4, 0x90
LBB0_7:                                 ##   in Loop: Header=BB0_4 Depth=2
	cmpq	$0, -64(%rbp)                   ## 8-byte Folded Reload
	je	LBB0_8
## %bb.9:                               ##   in Loop: Header=BB0_4 Depth=2
	pxor	%xmm0, %xmm0
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
	xorl	%edx, %edx
	pxor	%xmm1, %xmm1
	.p2align	4, 0x90
LBB0_10:                                ##   Parent Loop BB0_2 Depth=1
                                        ##     Parent Loop BB0_4 Depth=2
                                        ## =>    This Inner Loop Header: Depth=3
	movdqu	(%rcx,%rdx,4), %xmm2
	movdqu	16(%rcx,%rdx,4), %xmm3
	movdqu	32(%rcx,%rdx,4), %xmm4
	movdqu	48(%rcx,%rdx,4), %xmm5
	movdqu	(%rdi,%rdx,4), %xmm6
	pmulld	%xmm2, %xmm6
	paddd	%xmm0, %xmm6
	movdqu	16(%rdi,%rdx,4), %xmm2
	pmulld	%xmm3, %xmm2
	paddd	%xmm1, %xmm2
	movdqu	32(%rdi,%rdx,4), %xmm0
	pmulld	%xmm4, %xmm0
	paddd	%xmm6, %xmm0
	movdqu	48(%rdi,%rdx,4), %xmm1
	pmulld	%xmm5, %xmm1
	paddd	%xmm2, %xmm1
	addq	$16, %rdx
	addq	$-2, %rsi
	jne	LBB0_10
## %bb.11:                              ##   in Loop: Header=BB0_4 Depth=2
	testb	$1, -56(%rbp)                   ## 1-byte Folded Reload
	je	LBB0_13
LBB0_12:                                ##   in Loop: Header=BB0_4 Depth=2
	movdqu	(%rcx,%rdx,4), %xmm2
	movdqu	16(%rcx,%rdx,4), %xmm3
	movdqu	(%rdi,%rdx,4), %xmm4
	pmulld	%xmm2, %xmm4
	paddd	%xmm4, %xmm0
	movdqu	16(%rdi,%rdx,4), %xmm2
	pmulld	%xmm3, %xmm2
	paddd	%xmm2, %xmm1
LBB0_13:                                ##   in Loop: Header=BB0_4 Depth=2
	paddd	%xmm1, %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, %edx
	movq	%r10, %rsi
	cmpq	%r12, %r10
	je	LBB0_15
	.p2align	4, 0x90
LBB0_14:                                ##   Parent Loop BB0_2 Depth=1
                                        ##     Parent Loop BB0_4 Depth=2
                                        ## =>    This Inner Loop Header: Depth=3
	movl	(%rdi,%rsi,4), %ebx
	imull	(%rcx,%rsi,4), %ebx
	addl	%ebx, %edx
	incq	%rsi
	cmpq	%rsi, %r12
	jne	LBB0_14
	jmp	LBB0_15
LBB0_8:                                 ##   in Loop: Header=BB0_4 Depth=2
	pxor	%xmm0, %xmm0
	xorl	%edx, %edx
	pxor	%xmm1, %xmm1
	testb	$1, -56(%rbp)                   ## 1-byte Folded Reload
	jne	LBB0_12
	jmp	LBB0_13
LBB0_17:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_AV_SAMPLE_FMT_S16,8,3          ## @AV_SAMPLE_FMT_S16
	.no_dead_strip	_rematrix_channels
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function rematrix_channels
_rematrix_channels:                     ; @rematrix_channels
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	ldr	x20, [x0, #24]
	ldr	w8, [x20]
	cbz	w8, LBB0_15
; %bb.1:
	mov	x19, x0
	mov	x21, #0
	ldr	w22, [x0, #8]
	and	x23, x22, #0xfffffff0
Lloh0:
	adrp	x24, _AV_SAMPLE_FMT_S16@GOTPAGE
Lloh1:
	ldr	x24, [x24, _AV_SAMPLE_FMT_S16@GOTPAGEOFF]
	b	LBB0_3
LBB0_2:                                 ;   in Loop: Header=BB0_3 Depth=1
	add	x21, x21, #1
	ldr	w8, [x20]
	cmp	x21, x8
	b.hs	LBB0_15
LBB0_3:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_7 Depth 2
                                        ;       Child Loop BB0_11 Depth 3
                                        ;       Child Loop BB0_14 Depth 3
	ldr	x8, [x19, #16]
	ldr	x8, [x8]
	ldr	x9, [x24]
	cmp	x8, x9
	cset	w8, eq
	lsl	w8, w8, #3
	ldr	x9, [x20, #8]
	ldr	w9, [x9, x21, lsl #2]
	sub	w0, w8, w9
	bl	_MSB_MASK
	ldr	w8, [x19, #12]
	cbz	w8, LBB0_2
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	mov	w8, #0
	ldr	x9, [x19]
	ldr	x10, [x20, #16]
	ldr	w10, [x10, x21, lsl #2]
	b	LBB0_7
LBB0_5:                                 ;   in Loop: Header=BB0_7 Depth=2
	mov	w12, #0
LBB0_6:                                 ;   in Loop: Header=BB0_7 Depth=2
	and	w11, w0, w12, asr #14
	str	w11, [x9, x10, lsl #2]
	ldp	w11, w12, [x19, #8]
	add	x9, x9, x11, lsl #2
	add	w8, w8, #1
	cmp	w8, w12
	b.hs	LBB0_2
LBB0_7:                                 ;   Parent Loop BB0_3 Depth=1
                                        ; =>  This Loop Header: Depth=2
                                        ;       Child Loop BB0_11 Depth 3
                                        ;       Child Loop BB0_14 Depth 3
	cbz	w22, LBB0_5
; %bb.8:                                ;   in Loop: Header=BB0_7 Depth=2
	ldr	x11, [x20, #24]
	ldr	x11, [x11, x21, lsl #3]
	cmp	w22, #16
	b.hs	LBB0_10
; %bb.9:                                ;   in Loop: Header=BB0_7 Depth=2
	mov	x14, #0
	mov	w12, #0
	b	LBB0_13
LBB0_10:                                ;   in Loop: Header=BB0_7 Depth=2
	add	x12, x11, #32
	add	x13, x9, #32
	movi.2d	v0, #0000000000000000
	mov	x14, x23
	movi.2d	v1, #0000000000000000
	movi.2d	v2, #0000000000000000
	movi.2d	v3, #0000000000000000
LBB0_11:                                ;   Parent Loop BB0_3 Depth=1
                                        ;     Parent Loop BB0_7 Depth=2
                                        ; =>    This Inner Loop Header: Depth=3
	ldp	q4, q5, [x13, #-32]
	ldp	q6, q7, [x13], #64
	ldp	q16, q17, [x12, #-32]
	ldp	q18, q19, [x12], #64
	mla.4s	v0, v16, v4
	mla.4s	v1, v17, v5
	mla.4s	v2, v18, v6
	mla.4s	v3, v19, v7
	subs	x14, x14, #16
	b.ne	LBB0_11
; %bb.12:                               ;   in Loop: Header=BB0_7 Depth=2
	add.4s	v0, v1, v0
	add.4s	v0, v2, v0
	add.4s	v0, v3, v0
	addv.4s	s0, v0
	fmov	w12, s0
	mov	x14, x23
	cmp	x23, x22
	b.eq	LBB0_6
LBB0_13:                                ;   in Loop: Header=BB0_7 Depth=2
	lsl	x15, x14, #2
	add	x13, x9, x15
	add	x11, x11, x15
	sub	x14, x22, x14
LBB0_14:                                ;   Parent Loop BB0_3 Depth=1
                                        ;     Parent Loop BB0_7 Depth=2
                                        ; =>    This Inner Loop Header: Depth=3
	ldr	w15, [x13], #4
	ldr	w16, [x11], #4
	madd	w12, w16, w15, w12
	subs	x14, x14, #1
	b.ne	LBB0_14
	b	LBB0_6
LBB0_15:
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.cfi_endproc
                                        ; -- End function
	.comm	_AV_SAMPLE_FMT_S16,8,3          ; @AV_SAMPLE_FMT_S16
	.no_dead_strip	_rematrix_channels
.subsections_via_symbols
