// File: /workspace/github_c_makefile_star2_O2/georgeweigt[P]sassafras/sassafras.c
// Function: proc_anova_print_means
void
proc_anova_print_means(int x)
{
	int i, j, m, n;
	double q, t;
	char **a, *b, *s;

	q = qt(1 - alpha / 2, dfe);

	emit_line_center("Mean Response");
	emit_line("");

	// count the number of interactions

	m = 0;
	s = dataset->spec[x].name;
	while (*s)
		if (*s++ == '*')
			m++;

	n = dataset->spec[x].num_levels;

	a = (char **) xmalloc((5 + m) * (n + 1) * sizeof (char *));

	// split up interaction string

	s = dataset->spec[x].name;
	for (i = 0; i < m + 1; i++) {
		b = bigbuf;
		while (*s && *s != '*')
			*b++ = *s++;
		if (*s)
			s++;
		*b = 0;
		A(0, i) = strdup(bigbuf);
	}

	A(0, m + 1) = strdup("N");

	s = dataset->spec[yvar].name;
	snprintf(bigbuf, BIGBUFLEN, "Mean %s", s);
	A(0, m + 2) = strdup(bigbuf);

	snprintf(bigbuf, BIGBUFLEN, "%g%% CI MIN", 100 * (1 - alpha));
	A(0, m + 3) = strdup(bigbuf);

	snprintf(bigbuf, BIGBUFLEN, "%g%% CI MAX", 100 * (1 - alpha));
	A(0, m + 4) = strdup(bigbuf);

	for (i = 0; i < n; i++) {

		// Level (decompose interactions)

		s = dataset->spec[x].ltab[i];
		for (j = 0; j < m + 1; j++) {
			b = bigbuf;
			while (*s && *s != '*')
				*b++ = *s++;
			if (*s)
				s++;
			*b = 0;
			A(i + 1, j) = strdup(bigbuf);
		}

		// N

		snprintf(bigbuf, BIGBUFLEN, "%d", count[i]);
		A(i + 1, m + 1) = strdup(bigbuf);

		if (count[i] < 1) {
			A(i + 1, m + 2) = strdup(".");
			A(i + 1, m + 3) = strdup(".");
			A(i + 1, m + 4) = strdup(".");
			continue;
		}

		// Mean

		snprintf(bigbuf, BIGBUFLEN, "%0.6f", mean[i]);
		A(i + 1, m + 2) = strdup(bigbuf);

		// Confidence Interval

		t = q * sqrt(mse / count[i]);

		snprintf(bigbuf, BIGBUFLEN, "%0.6f", mean[i] - t);
		A(i + 1, m + 3) = strdup(bigbuf);

		snprintf(bigbuf, BIGBUFLEN, "%0.6f", mean[i] + t);
		A(i + 1, m + 4) = strdup(bigbuf);
	}

	for (i = 0; i < m + 1; i++)
		bigbuf[i] = 1;
	bigbuf[m + 1] = 0;
	bigbuf[m + 2] = 0;
	bigbuf[m + 3] = 0;
	bigbuf[m + 4] = 0;

	print_table_and_free(a, n + 1, 5 + m, bigbuf);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movsd 0xf156(%rip), %xmm0     # 0x13ed8
mulsd 0x6576(%rip), %xmm0     # 0xb300
movl %edi, %ebx
addsd 0x6534(%rip), %xmm0     # 0xb2c8
movsd 0xfcb4(%rip), %xmm1     # 0x14a50
callq 0x74c5
movsd %xmm0, -0x68(%rbp)
leaq 0x6b02(%rip), %rdi      # 0xb8af
callq 0x3df6
pushq $0xa
popq %rdi
callq 0x2050
movq 0xf107(%rip), %rax      # 0x13ec8
movslq %ebx, %rcx
imulq $0x28, %rcx, %rcx
movq %rcx, -0x58(%rbp)
movq 0x20(%rax,%rcx), %rcx
addq $0x20, %rax
xorl %r15d, %r15d
movb (%rcx), %dl
testb %dl, %dl
je 0x4def
incq %rcx
xorl %esi, %esi
cmpb $0x2a, %dl
sete %sil
addl %esi, %r15d
jmp 0x4dd8
movq -0x58(%rbp), %r14
movl 0xc(%rax,%r14), %eax
leal 0x5(%r15), %edi
movq %rax, -0x48(%rbp)
incl %eax
movl %edi, -0x2c(%rbp)
movl %eax, -0x4c(%rbp)
imull %eax, %edi
shll $0x3, %edi
callq 0x2a9b
movq %rax, -0x40(%rbp)
movq 0xf0aa(%rip), %rbx      # 0x13ec8
movq 0x20(%rbx,%r14), %r14
addq $0x20, %rbx
movl %r15d, %eax
movq %rax, -0x38(%rbp)
leaq 0x1(%rax), %r15
xorl %r13d, %r13d
leaq 0xe084(%rip), %r12      # 0x12ec0
cmpq %r15, %r13
je 0x4e7e
xorl %eax, %eax
movzbl (%r14,%rax), %ecx
testl %ecx, %ecx
je 0x4e5a
cmpl $0x2a, %ecx
je 0x4e5a
movb %cl, (%rax,%r12)
incq %rax
jmp 0x4e43
cmpb $0x1, %cl
sbbq $-0x1, %r14
addq %rax, %r14
movb $0x0, (%rax,%r12)
movq %r12, %rdi
callq 0x2210
movq -0x40(%rbp), %rcx
movq %rax, (%rcx,%r13,8)
incq %r13
jmp 0x4e3c
leaq 0x6d54(%rip), %rdi      # 0xbbd9
callq 0x2210
movq -0x40(%rbp), %r14
movq -0x38(%rbp), %r13
movq %rax, 0x8(%r14,%r13,8)
movslq 0xf6e2(%rip), %rax      # 0x14580
imulq $0x28, %rax, %rax
movq (%rbx,%rax), %rcx
leaq 0x6a10(%rip), %rdx      # 0xb8bd
xorl %ebx, %ebx
movl $0xfa0, %esi            # imm = 0xFA0
movq %r12, %rdi
xorl %eax, %eax
callq 0x20e0
movq %r12, %rdi
callq 0x2210
movq %rax, 0x10(%r14,%r13,8)
movsd 0x63f5(%rip), %xmm0     # 0xb2c8
subsd 0xeffd(%rip), %xmm0     # 0x13ed8
mulsd 0x6425(%rip), %xmm0     # 0xb308
leaq 0x69db(%rip), %rdx      # 0xb8c5
movl $0xfa0, %esi            # imm = 0xFA0
movq %r12, %rdi
movb $0x1, %al
callq 0x20e0
movq %r12, %rdi
callq 0x2210
movq %rax, 0x18(%r14,%r13,8)
movsd 0x63ba(%rip), %xmm0     # 0xb2c8
subsd 0xefc2(%rip), %xmm0     # 0x13ed8
mulsd 0x63ea(%rip), %xmm0     # 0xb308
leaq 0x69ac(%rip), %rdx      # 0xb8d1
movl $0xfa0, %esi            # imm = 0xFA0
movq %r12, %rdi
movb $0x1, %al
callq 0x20e0
movq %r12, %rdi
callq 0x2210
movq %rax, 0x20(%r14,%r13,8)
movq -0x48(%rbp), %rax
testl %eax, %eax
cmovlel %ebx, %eax
movq %rax, -0x48(%rbp)
movl -0x2c(%rbp), %eax
movq %rax, -0x70(%rbp)
xorl %edx, %edx
cmpq -0x48(%rbp), %rdx
je 0x5127
movq 0xef60(%rip), %rax      # 0x13ec8
movq -0x58(%rbp), %rcx
movq 0x30(%rax,%rcx), %rax
movq (%rax,%rdx,8), %r14
movq %rdx, -0x60(%rbp)
leaq 0x1(%rdx), %rax
movq %rax, -0x88(%rbp)
imulq -0x70(%rbp), %rax
movq -0x40(%rbp), %rcx
leaq (%rcx,%rax,8), %rbx
xorl %r13d, %r13d
cmpq %r15, %r13
je 0x4fd2
xorl %eax, %eax
movzbl (%r14,%rax), %ecx
testl %ecx, %ecx
je 0x4fb2
cmpl $0x2a, %ecx
je 0x4fb2
movb %cl, (%rax,%r12)
incq %rax
jmp 0x4f9b
cmpb $0x1, %cl
sbbq $-0x1, %r14
addq %rax, %r14
movb $0x0, (%rax,%r12)
movq %r12, %rdi
callq 0x2210
movq %rax, (%rbx,%r13,8)
incq %r13
jmp 0x4f94
leaq 0x10627(%rip), %r14     # 0x15600
movq -0x60(%rbp), %r13
movl (%r14,%r13,4), %ecx
movl $0xfa0, %esi            # imm = 0xFA0
movq %r12, %rdi
leaq 0x6434(%rip), %rdx      # 0xb424
xorl %eax, %eax
callq 0x20e0
movq %r12, %rdi
callq 0x2210
movq -0x38(%rbp), %rcx
movq %rax, 0x8(%rbx,%rcx,8)
cmpl $0x0, (%r14,%r13,4)
jle 0x5060
leaq 0xffaa(%rip), %rax      # 0x14fc0
movsd (%rax,%r13,8), %xmm0
movl $0xfa0, %esi            # imm = 0xFA0
movq %r12, %rdi
leaq 0x6341(%rip), %rdx      # 0xb36c
movb $0x1, %al
callq 0x20e0
movq %r12, %rdi
callq 0x2210
movq %rax, -0x80(%rbp)
cvtsi2sdl (%r14,%r13,4), %xmm1
movsd 0xfa14(%rip), %xmm0     # 0x14a60
divsd %xmm1, %xmm0
ucomisd 0x62b8(%rip), %xmm0     # 0xb310
jb 0x508b
sqrtsd %xmm0, %xmm0
jmp 0x5090
leaq 0x6836(%rip), %r13      # 0xb89d
movq %r13, %rdi
callq 0x2210
movq %rax, %r14
movq %r13, %rdi
callq 0x2210
movq %rax, %r13
leaq 0x6819(%rip), %rdi      # 0xb89d
callq 0x2210
jmp 0x5108
callq 0x2200
mulsd -0x68(%rbp), %xmm0
leaq 0xff24(%rip), %rax      # 0x14fc0
movq -0x60(%rbp), %r14
movapd %xmm0, %xmm1
movsd %xmm0, -0x78(%rbp)
movsd (%rax,%r14,8), %xmm0
subsd %xmm1, %xmm0
movl $0xfa0, %esi            # imm = 0xFA0
movq %r12, %rdi
leaq 0x62aa(%rip), %rdx      # 0xb36c
movb $0x1, %al
callq 0x20e0
movq %r12, %rdi
callq 0x2210
movq %rax, %r13
movsd -0x78(%rbp), %xmm0
leaq 0xfee0(%rip), %rax      # 0x14fc0
addsd (%rax,%r14,8), %xmm0
movl $0xfa0, %esi            # imm = 0xFA0
movq %r12, %rdi
leaq 0x6277(%rip), %rdx      # 0xb36c
movb $0x1, %al
callq 0x20e0
movq %r12, %rdi
callq 0x2210
movq -0x80(%rbp), %r14
movq -0x38(%rbp), %rcx
movq %r14, 0x10(%rbx,%rcx,8)
movq %r13, 0x18(%rbx,%rcx,8)
movq %rax, 0x20(%rbx,%rcx,8)
movq -0x88(%rbp), %rdx
jmp 0x4f57
xorl %eax, %eax
cmpq %rax, %r15
je 0x5138
movb $0x1, (%rax,%r12)
incq %rax
jmp 0x5129
xorl %eax, %eax
movb %al, (%r15,%r12)
movq -0x38(%rbp), %rcx
movb %al, 0x2(%rcx,%r12)
movb %al, 0x3(%rcx,%r12)
movb %al, 0x4(%rcx,%r12)
movq -0x40(%rbp), %rdi
movl -0x4c(%rbp), %esi
movl -0x2c(%rbp), %edx
movq %r12, %rcx
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4411