// File: /workspace/github_c_makefile_star2_O3/hansvanstaveren[P]BigDeal/output.c
// Function: compute_stat
static void
compute_stat(FILE *out, int boardno, hr_p hrp)
/*
 * Compute statistics on this hand
 */
{
	dl_byh *dbhp = hrp->hr_value.hv_dbhp;
	int i, compass, card;
	int length, maxlength, suitlength[NCOMPASS][NSUIT];
	int hcp;

	for (compass=0; compass<NCOMPASS; compass++) {
		for (i=0; i<NSUIT; i++)
			suitlength[compass][i] = 0;
		hcp = 0;
		for (i=0; i<NCARDSPERHAND; i++) {
			/*
			 * Note the -1 to convert from 1..52 to 0..51
			 */
			card = dbhp->dh_hand[compass][i]-1;
			/*
			 * card/13 should be suit
			 */
			suitlength[compass][card/13]++;
			/*
			 * card%13 should be pip
			 */
			hcp += high_card_points[card%13];
		}
		stats.st_hcp[compass] += hcp;
		stats.st_hcpfreq[hcp]++;
		maxlength = 0;
		for (i=0; i<NSUIT; i++) {
			length = suitlength[compass][i];
			if (length > maxlength)
				maxlength = length;
			stats.st_sumsquare += length*length;
		}
		if (maxlength > stats.st_longestsuit)
			stats.st_longestsuit = maxlength;
		stats.st_lsuitfreq[compass][maxlength]++;
	}
	/*
	 * Now suitlength[][] contains all suit lengths for all hands
	 * 16 numbers in all.
	 * Statistics about distribution to be added here.
	 */
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq 0x8(%rdx), %rax
xorl %ecx, %ecx
pxor %xmm0, %xmm0
leaq 0x1ea0(%rip), %rdx      # 0x7830
leaq 0x8545(%rip), %rsi      # 0xdedc
movq %rcx, %rdi
shlq $0x4, %rdi
leaq (%rsp,%rdi), %r8
addq $-0x40, %r8
movdqa %xmm0, (%r8)
movq $-0xd, %r10
xorl %r9d, %r9d
movzbl 0xd(%rax,%r10), %r11d
leal -0x1(%r11), %ebx
imull $0x4ec5, %ebx, %ebx     # imm = 0x4EC5
movl %ebx, %ebp
shrl $0x1f, %ebp
sarl $0x12, %ebx
addl %ebp, %ebx
movzwl %bx, %r14d
incl (%r8,%r14,4)
leal (%rbx,%rbx,2), %r14d
leal (%rbx,%r14,4), %ebx
negl %ebx
addl %ebx, %r11d
decl %r11d
movswq %r11w, %r11
movslq (%rdx,%r11,4), %r11
movslq %r9d, %r9
addq %r11, %r9
incq %r10
jne 0x59b5
addl %r9d, 0x4(%rsi,%rcx,4)
incl 0x14(%rsi,%r9,4)
movd 0x84d0(%rip), %xmm1     # 0xdedc
movdqa -0x40(%rsp,%rdi), %xmm2
pshufd $0xf5, %xmm2, %xmm3     # xmm3 = xmm2[1,1,3,3]
movdqa %xmm2, %xmm4
pcmpgtd %xmm0, %xmm4
pand %xmm2, %xmm4
pmuludq %xmm2, %xmm2
pshufd $0xe8, %xmm2, %xmm2     # xmm2 = xmm2[0,2,2,3]
pmuludq %xmm3, %xmm3
pshufd $0xe8, %xmm3, %xmm3     # xmm3 = xmm3[0,2,2,3]
punpckldq %xmm3, %xmm2    # xmm2 = xmm2[0],xmm3[0],xmm2[1],xmm3[1]
paddd %xmm1, %xmm2
pshufd $0xee, %xmm4, %xmm1     # xmm1 = xmm4[2,3,2,3]
movdqa %xmm4, %xmm3
pcmpgtd %xmm1, %xmm3
pand %xmm3, %xmm4
pandn %xmm1, %xmm3
por %xmm4, %xmm3
pshufd $0x55, %xmm3, %xmm1     # xmm1 = xmm3[1,1,1,1]
movdqa %xmm3, %xmm4
pcmpgtd %xmm1, %xmm4
pand %xmm4, %xmm3
pandn %xmm1, %xmm4
por %xmm3, %xmm4
movd %xmm4, %edi
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, 0x844f(%rip)     # 0xdedc
cmpl 0x85d5(%rip), %edi      # 0xe068
jle 0x5a9b
movl %edi, 0x85cd(%rip)      # 0xe068
movl %edi, %edi
imulq $0x38, %rcx, %r8
addq %rsi, %r8
incl 0xac(%r8,%rdi,4)
incq %rcx
addq $0xd, %rax
cmpq $0x4, %rcx
jne 0x5997
popq %rbx
popq %r14
popq %rbp
retq