	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function qdm2_packet_checksum
_qdm2_packet_checksum:                  ## @qdm2_packet_checksum
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	testl	%esi, %esi
	jle	LBB0_11
## %bb.1:
	movl	%esi, %eax
	cmpl	$4, %esi
	jae	LBB0_3
## %bb.2:
	xorl	%ecx, %ecx
	jmp	LBB0_10
LBB0_3:
	movl	%eax, %ecx
	andl	$-4, %ecx
	movd	%edx, %xmm0
	leaq	-4(%rcx), %rdx
	movq	%rdx, %r8
	shrq	$2, %r8
	incq	%r8
	testq	%rdx, %rdx
	je	LBB0_4
## %bb.5:
	movq	%r8, %rdx
	andq	$-2, %rdx
	pxor	%xmm1, %xmm1
	xorl	%esi, %esi
	.p2align	4, 0x90
LBB0_6:                                 ## =>This Inner Loop Header: Depth=1
	movdqu	(%rdi,%rsi,8), %xmm2
	movdqu	16(%rdi,%rsi,8), %xmm3
	movdqu	32(%rdi,%rsi,8), %xmm4
	paddd	%xmm2, %xmm4
	movdqu	48(%rdi,%rsi,8), %xmm2
	paddd	%xmm3, %xmm2
	pshufd	$232, %xmm4, %xmm3              ## xmm3 = xmm4[0,2,2,3]
	psubd	%xmm3, %xmm0
	pshufd	$232, %xmm2, %xmm2              ## xmm2 = xmm2[0,2,2,3]
	psubd	%xmm2, %xmm1
	addq	$8, %rsi
	addq	$-2, %rdx
	jne	LBB0_6
## %bb.7:
	testb	$1, %r8b
	je	LBB0_9
LBB0_8:
	movdqu	(%rdi,%rsi,8), %xmm2
	movdqu	16(%rdi,%rsi,8), %xmm3
	pshufd	$232, %xmm2, %xmm2              ## xmm2 = xmm2[0,2,2,3]
	psubd	%xmm2, %xmm0
	pshufd	$232, %xmm3, %xmm2              ## xmm2 = xmm3[0,2,2,3]
	psubd	%xmm2, %xmm1
LBB0_9:
	paddd	%xmm1, %xmm0
	pshufd	$85, %xmm0, %xmm1               ## xmm1 = xmm0[1,1,1,1]
	paddd	%xmm0, %xmm1
	movd	%xmm1, %edx
	cmpq	%rax, %rcx
	je	LBB0_11
	.p2align	4, 0x90
LBB0_10:                                ## =>This Inner Loop Header: Depth=1
	subl	(%rdi,%rcx,8), %edx
	incq	%rcx
	cmpq	%rcx, %rax
	jne	LBB0_10
LBB0_11:
	movzwl	%dx, %eax
	popq	%rbp
	retq
LBB0_4:
	pxor	%xmm1, %xmm1
	xorl	%esi, %esi
	testb	$1, %r8b
	jne	LBB0_8
	jmp	LBB0_9
	.cfi_endproc
                                        ## -- End function
	.no_dead_strip	_qdm2_packet_checksum
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function qdm2_packet_checksum
_qdm2_packet_checksum:                  ; @qdm2_packet_checksum
	.cfi_startproc
; %bb.0:
	cmp	w1, #1
	b.lt	LBB0_8
; %bb.1:
	mov	w8, w1
	cmp	w1, #8
	b.hs	LBB0_3
; %bb.2:
	mov	x9, #0
	b	LBB0_6
LBB0_3:
	movi	d0, #0000000000000000
	mov.s	v0[0], w2
	and	x9, x8, #0xfffffff8
	movi.2d	v1, #0000000000000000
	add	x10, x0, #32
	mov	x11, x9
	movi.2d	v2, #0000000000000000
	movi.2d	v3, #0000000000000000
LBB0_4:                                 ; =>This Inner Loop Header: Depth=1
	ldp	q4, q5, [x10, #-32]
	ldp	q6, q7, [x10], #64
	xtn.2s	v4, v4
	xtn.2s	v5, v5
	xtn.2s	v6, v6
	xtn.2s	v7, v7
	sub.2s	v0, v0, v4
	sub.2s	v1, v1, v5
	sub.2s	v2, v2, v6
	sub.2s	v3, v3, v7
	subs	x11, x11, #8
	b.ne	LBB0_4
; %bb.5:
	add.2s	v0, v1, v0
	add.2s	v0, v2, v0
	add.2s	v0, v3, v0
	addp.2s	v0, v0, v0
	fmov	w2, s0
	cmp	x9, x8
	b.eq	LBB0_8
LBB0_6:
	add	x10, x0, x9, lsl #3
	sub	x8, x8, x9
LBB0_7:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w9, [x10], #8
	sub	w2, w2, w9
	subs	x8, x8, #1
	b.ne	LBB0_7
LBB0_8:
	and	w0, w2, #0xffff
	ret
	.cfi_endproc
                                        ; -- End function
	.no_dead_strip	_qdm2_packet_checksum
.subsections_via_symbols
