// File: /workspace/github_c_makefile_star2_O3/ravenexp[P]aatrace/cover.c
// Function: aatrace_cover_tile_score
unsigned int
aatrace_cover_tile_score(const struct aatrace_pic* pic,
			 const struct aatrace_font* font,
			 int tl, int tc, int dx, int dy,
			 const struct aatrace_match_ctx* ctx)
{
	const unsigned char* p =
		pic->buf + font->h*pic->ll*tl + font->w*tc;
	unsigned int score = 0;
	int i;

	if (dy > 0)
		for (i = 0; i < dy; i++)
			score += edge_score(p + i*pic->ll, FW, 1, ctx);
	if (dy < 0)
		for (i = dy; i < 0; i++)
			score += edge_score(p + (font->h + i)*pic->ll, FW, 1, ctx);

	if (dx > 0)
		for (i = 0; i < dx; i++)
			score += edge_score(p + i, FH, pic->ll, ctx);
	if (dx < 0)
		for (i = dx; i < 0; i++)
			score += edge_score(p + font->w + i, FH, pic->ll, ctx);

	return score;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq 0x30(%rsp), %r10
movl 0x1c(%rsi), %ebx
movl 0x8(%rdi), %r11d
imull %ebx, %edx
imull %r11d, %edx
addq (%rdi), %rdx
movslq 0x18(%rsi), %rsi
movslq %ecx, %rcx
imulq %rsi, %rcx
addq %rdx, %rcx
testl %r9d, %r9d
jle 0x1f84
movl (%r10), %edx
movl %r9d, %edi
xorl %ebp, %ebp
pxor %xmm0, %xmm0
xorl %eax, %eax
movl %ebp, %r14d
movd (%rcx,%r14), %xmm1
punpcklbw %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1],xmm1[2],xmm0[2],xmm1[3],xmm0[3],xmm1[4],xmm0[4],xmm1[5],xmm0[5],xmm1[6],xmm0[6],xmm1[7],xmm0[7]
punpcklwd %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1],xmm1[2],xmm0[2],xmm1[3],xmm0[3]
movd 0x4(%rcx,%r14), %xmm2
punpcklbw %xmm0, %xmm2    # xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1],xmm2[2],xmm0[2],xmm2[3],xmm0[3],xmm2[4],xmm0[4],xmm2[5],xmm0[5],xmm2[6],xmm0[6],xmm2[7],xmm0[7]
punpcklwd %xmm0, %xmm2    # xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1],xmm2[2],xmm0[2],xmm2[3],xmm0[3]
paddd %xmm1, %xmm2
pshufd $0xee, %xmm2, %xmm1     # xmm1 = xmm2[2,3,2,3]
paddd %xmm2, %xmm1
pshufd $0x55, %xmm1, %xmm2     # xmm2 = xmm1[1,1,1,1]
paddd %xmm1, %xmm2
movd %xmm2, %r14d
cmpl $0x2, %edx
jne 0x1f77
movl 0x8(%r10), %r15d
addl 0x4(%r10), %r15d
imull %r15d, %r14d
addl %r14d, %eax
addl %r11d, %ebp
decq %rdi
jne 0x1f2b
jmp 0x1f86
xorl %eax, %eax
testl %r9d, %r9d
jns 0x1ff1
movl (%r10), %edx
addl %r9d, %ebx
decl %r9d
imull %r11d, %ebx
pxor %xmm0, %xmm0
movl %ebx, %edi
movd (%rcx,%rdi), %xmm1
punpcklbw %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1],xmm1[2],xmm0[2],xmm1[3],xmm0[3],xmm1[4],xmm0[4],xmm1[5],xmm0[5],xmm1[6],xmm0[6],xmm1[7],xmm0[7]
punpcklwd %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1],xmm1[2],xmm0[2],xmm1[3],xmm0[3]
movd 0x4(%rcx,%rdi), %xmm2
punpcklbw %xmm0, %xmm2    # xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1],xmm2[2],xmm0[2],xmm2[3],xmm0[3],xmm2[4],xmm0[4],xmm2[5],xmm0[5],xmm2[6],xmm0[6],xmm2[7],xmm0[7]
punpcklwd %xmm0, %xmm2    # xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1],xmm2[2],xmm0[2],xmm2[3],xmm0[3]
paddd %xmm1, %xmm2
pshufd $0xee, %xmm2, %xmm1     # xmm1 = xmm2[2,3,2,3]
paddd %xmm2, %xmm1
pshufd $0x55, %xmm1, %xmm2     # xmm2 = xmm1[1,1,1,1]
paddd %xmm1, %xmm2
movd %xmm2, %edi
cmpl $0x2, %edx
jne 0x1fe3
movl 0x8(%r10), %ebp
addl 0x4(%r10), %ebp
imull %ebp, %edi
addl %edi, %eax
incl %r9d
addl %r11d, %ebx
cmpl $-0x1, %r9d
jl 0x1f9c
testl %r8d, %r8d
jle 0x203a
movl (%r10), %edx
movl %r8d, %edi
xorl %r9d, %r9d
leaq (%rcx,%r9), %r14
movl $0x10, %r15d
xorl %ebp, %ebp
xorl %ebx, %ebx
movl %ebp, %r12d
movzbl (%r14,%r12), %r12d
addl %r12d, %ebx
addl %r11d, %ebp
decq %r15
jne 0x200d
cmpl $0x2, %edx
jne 0x2030
movl 0x8(%r10), %ebp
addl 0x4(%r10), %ebp
imull %ebp, %ebx
addl %ebx, %eax
incq %r9
cmpq %rdi, %r9
jne 0x1fff
testl %r8d, %r8d
jns 0x2080
addq %rsi, %rcx
movl (%r10), %edx
movslq %r8d, %rsi
leaq (%rcx,%rsi), %r8
movl $0x10, %r9d
xorl %ebx, %ebx
xorl %edi, %edi
movl %ebx, %r14d
movzbl (%r8,%r14), %ebp
addl %ebp, %edi
addl %r11d, %ebx
decq %r9
jne 0x2056
cmpl $0x2, %edx
jne 0x2079
movl 0x8(%r10), %r8d
addl 0x4(%r10), %r8d
imull %r8d, %edi
addl %edi, %eax
incq %rsi
jne 0x2048
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)