	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function image_sad
_image_sad:                             ## @image_sad
	.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
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	testl	%ecx, %ecx
	jle	LBB0_1
## %bb.2:
	sarl	$3, %r9d
	sarl	$3, %r8d
	movslq	%r8d, %r8
	movslq	%r9d, %r9
	movl	%edx, %r10d
	movl	%r10d, %r11d
	andl	$-4, %r11d
	shlq	$3, %r8
	shlq	$3, %r9
	leaq	(,%r10,8), %r15
	andq	$-32, %r15
	xorl	%r14d, %r14d
	xorl	%eax, %eax
	jmp	LBB0_3
	.p2align	4, 0x90
LBB0_10:                                ##   in Loop: Header=BB0_3 Depth=1
	incl	%r14d
	addq	%r8, %rdi
	addq	%r9, %rsi
	cmpl	%ecx, %r14d
	je	LBB0_11
LBB0_3:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_7 Depth 2
                                        ##     Child Loop BB0_9 Depth 2
	testl	%edx, %edx
	jle	LBB0_10
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=1
	cmpl	$4, %edx
	jae	LBB0_6
## %bb.5:                               ##   in Loop: Header=BB0_3 Depth=1
	xorl	%r12d, %r12d
	jmp	LBB0_9
	.p2align	4, 0x90
LBB0_6:                                 ##   in Loop: Header=BB0_3 Depth=1
	movd	%eax, %xmm4
	pxor	%xmm3, %xmm3
	xorl	%eax, %eax
	.p2align	4, 0x90
LBB0_7:                                 ##   Parent Loop BB0_3 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movdqu	(%rdi,%rax), %xmm1
	movdqu	16(%rdi,%rax), %xmm2
	movdqu	(%rsi,%rax), %xmm0
	psubq	%xmm0, %xmm1
	movdqu	16(%rsi,%rax), %xmm0
	psubq	%xmm0, %xmm2
	pxor	%xmm5, %xmm5
	psubq	%xmm1, %xmm5
	movdqa	%xmm1, %xmm0
	blendvpd	%xmm0, %xmm5, %xmm1
	pxor	%xmm5, %xmm5
	psubq	%xmm2, %xmm5
	movdqa	%xmm2, %xmm0
	blendvpd	%xmm0, %xmm5, %xmm2
	pshufd	$232, %xmm1, %xmm0              ## xmm0 = xmm1[0,2,2,3]
	paddd	%xmm0, %xmm4
	pshufd	$232, %xmm2, %xmm0              ## xmm0 = xmm2[0,2,2,3]
	paddd	%xmm0, %xmm3
	addq	$32, %rax
	cmpq	%rax, %r15
	jne	LBB0_7
## %bb.8:                               ##   in Loop: Header=BB0_3 Depth=1
	paddd	%xmm4, %xmm3
	pshufd	$85, %xmm3, %xmm0               ## xmm0 = xmm3[1,1,1,1]
	paddd	%xmm3, %xmm0
	movd	%xmm0, %eax
	movq	%r11, %r12
	cmpq	%r10, %r11
	je	LBB0_10
	.p2align	4, 0x90
LBB0_9:                                 ##   Parent Loop BB0_3 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movq	(%rdi,%r12,8), %r13
	subq	(%rsi,%r12,8), %r13
	movq	%r13, %rbx
	negq	%rbx
	cmovsq	%r13, %rbx
	addl	%ebx, %eax
	incq	%r12
	cmpq	%r12, %r10
	jne	LBB0_9
	jmp	LBB0_10
LBB0_1:
	xorl	%eax, %eax
LBB0_11:
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.no_dead_strip	_image_sad
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function image_sad
_image_sad:                             ; @image_sad
	.cfi_startproc
; %bb.0:
	cmp	w3, #1
	b.lt	LBB0_11
; %bb.1:
	mov	w9, #0
	mov	w8, #0
	asr	w13, w5, #3
	asr	w14, w4, #3
	mov	w10, w2
	and	x11, x10, #0xfffffff8
	lsl	x12, x10, #3
	and	x12, x12, #0x7ffffffc0
	sbfiz	x13, x13, #3, #32
	sbfiz	x14, x14, #3, #32
	b	LBB0_3
LBB0_2:                                 ;   in Loop: Header=BB0_3 Depth=1
	add	w9, w9, #1
	add	x1, x1, x13
	add	x0, x0, x14
	cmp	w9, w3
	b.eq	LBB0_10
LBB0_3:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_7 Depth 2
                                        ;     Child Loop BB0_9 Depth 2
	cmp	w2, #1
	b.lt	LBB0_2
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	cmp	w2, #8
	b.hs	LBB0_6
; %bb.5:                                ;   in Loop: Header=BB0_3 Depth=1
	mov	x15, #0
	b	LBB0_9
LBB0_6:                                 ;   in Loop: Header=BB0_3 Depth=1
	mov	x15, #0
	movi	d0, #0000000000000000
	mov.s	v0[0], w8
	movi.2d	v1, #0000000000000000
	movi.2d	v2, #0000000000000000
	movi.2d	v3, #0000000000000000
LBB0_7:                                 ;   Parent Loop BB0_3 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	add	x8, x0, x15
	ldp	q4, q5, [x8]
	ldp	q6, q7, [x8, #32]
	add	x8, x1, x15
	ldp	q16, q17, [x8]
	ldp	q18, q19, [x8, #32]
	sub.2d	v4, v4, v16
	sub.2d	v5, v5, v17
	sub.2d	v6, v6, v18
	sub.2d	v7, v7, v19
	abs.2d	v4, v4
	abs.2d	v5, v5
	abs.2d	v6, v6
	abs.2d	v7, v7
	xtn.2s	v4, v4
	xtn.2s	v5, v5
	xtn.2s	v6, v6
	xtn.2s	v7, v7
	add.2s	v0, v0, v4
	add.2s	v1, v1, v5
	add.2s	v2, v2, v6
	add.2s	v3, v3, v7
	add	x15, x15, #64
	cmp	x12, x15
	b.ne	LBB0_7
; %bb.8:                                ;   in Loop: Header=BB0_3 Depth=1
	add.2s	v0, v1, v0
	add.2s	v0, v2, v0
	add.2s	v0, v3, v0
	addp.2s	v0, v0, v0
	fmov	w8, s0
	mov	x15, x11
	cmp	x11, x10
	b.eq	LBB0_2
LBB0_9:                                 ;   Parent Loop BB0_3 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	lsl	x16, x15, #3
	ldr	x17, [x0, x16]
	ldr	x16, [x1, x16]
	subs	x16, x17, x16
	cneg	x16, x16, mi
	add	w8, w8, w16
	add	x15, x15, #1
	cmp	x10, x15
	b.ne	LBB0_9
	b	LBB0_2
LBB0_10:
	mov	x0, x8
	ret
LBB0_11:
	mov	w0, #0
	ret
	.cfi_endproc
                                        ; -- End function
	.no_dead_strip	_image_sad
.subsections_via_symbols
