// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x20(%rbp)
movl $0x0, -0x28(%rbp)
cmpl $0x4, -0x28(%rbp)
jge 0x8852
movl $0x0, -0x24(%rbp)
cmpl $0x4, -0x24(%rbp)
jge 0x86d2
movslq -0x28(%rbp), %rcx
leaq -0x80(%rbp), %rax
shlq $0x4, %rcx
addq %rcx, %rax
movslq -0x24(%rbp), %rcx
movl $0x0, (%rax,%rcx,4)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x86a7
movl $0x0, -0x84(%rbp)
movl $0x0, -0x24(%rbp)
cmpl $0xd, -0x24(%rbp)
jge 0x8772
movq -0x20(%rbp), %rax
movslq -0x28(%rbp), %rcx
imulq $0xd, %rcx, %rcx
addq %rcx, %rax
movslq -0x24(%rbp), %rcx
movzbl (%rax,%rcx), %eax
subl $0x1, %eax
movl %eax, -0x2c(%rbp)
movslq -0x28(%rbp), %rcx
leaq -0x80(%rbp), %rax
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x90(%rbp)
movl -0x2c(%rbp), %eax
movl $0xd, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movq -0x90(%rbp), %rax
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
movl -0x2c(%rbp), %eax
movl $0xd, %ecx
cltd
idivl %ecx
movslq %edx, %rcx
leaq 0x533b(%rip), %rax      # 0xda90
movl (%rax,%rcx,4), %eax
addl -0x84(%rbp), %eax
movl %eax, -0x84(%rbp)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x86e3
movl -0x84(%rbp), %edx
movslq -0x28(%rbp), %rcx
leaq 0x7949(%rip), %rax      # 0x100cc
addl 0x4(%rax,%rcx,4), %edx
leaq 0x793e(%rip), %rax      # 0x100cc
movl %edx, 0x4(%rax,%rcx,4)
movslq -0x84(%rbp), %rcx
leaq 0x792c(%rip), %rax      # 0x100cc
movl 0x14(%rax,%rcx,4), %edx
addl $0x1, %edx
leaq 0x791e(%rip), %rax      # 0x100cc
movl %edx, 0x14(%rax,%rcx,4)
movl $0x0, -0x34(%rbp)
movl $0x0, -0x24(%rbp)
cmpl $0x4, -0x24(%rbp)
jge 0x880b
movslq -0x28(%rbp), %rcx
leaq -0x80(%rbp), %rax
shlq $0x4, %rcx
addq %rcx, %rax
movslq -0x24(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x30(%rbp)
movl -0x30(%rbp), %eax
cmpl -0x34(%rbp), %eax
jle 0x87ed
movl -0x30(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x30(%rbp), %eax
imull -0x30(%rbp), %eax
addl 0x78d2(%rip), %eax      # 0x100cc
movl %eax, 0x78cc(%rip)      # 0x100cc
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x87c0
movl -0x34(%rbp), %eax
cmpl 0x7a44(%rip), %eax      # 0x10258
jle 0x881f
movl -0x34(%rbp), %eax
movl %eax, 0x7a39(%rip)      # 0x10258
movslq -0x28(%rbp), %rcx
leaq 0x78a2(%rip), %rax      # 0x100cc
addq $0xac, %rax
imulq $0x38, %rcx, %rcx
addq %rcx, %rax
movslq -0x34(%rbp), %rcx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x8696
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax,%rax)