// File: /workspace/github_c_makefile_star2_O3/georgeweigt[P]sassafras/sassafras.c
// Function: proc_anova_print_lsd
void
proc_anova_print_lsd(int x)
{
	int i, j, k, n, ncol, nrow;
	char **a, *s;
	double d, lsd, pval, q, se, tval;

	emit_line_center("Least Significant Difference Test");
	emit_line("");

	q = qt(1 - alpha / 2, dfe); // degrees of freedom error

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

	nrow = 1 + n * (n - 1);

	ncol = 7;

	a = (char **) xmalloc(nrow * ncol * sizeof (char *));

	s = dataset->spec[x].name;
	A(0, 0) = strdup(s);
	A(0, 1) = strdup(s);

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

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

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

	A(0, 5) = strdup("t Value");
	A(0, 6) = strdup("Pr > |t|  ");

	k = 0;

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

			if (i == j)
				continue;

			k++;

			// Level

			s = dataset->spec[x].ltab[i];
			A(k, 0) = strdup(s);

			// Level

			s = dataset->spec[x].ltab[j];
			A(k, 1) = strdup(s);

			// Sanity check

			if (count[i] == 0 || count[j] == 0) {
				A(k, 2) = strdup(".");
				A(k, 3) = strdup(".");
				A(k, 4) = strdup(".");
				A(k, 5) = strdup(".");
				A(k, 6) = strdup(".  ");
				continue;
			}

			// Difference

			d = mean[i] - mean[j];
			snprintf(bigbuf, BIGBUFLEN, "%0.6f", d);
			A(k, 2) = strdup(bigbuf);

			// confidence interval

			se = sqrt(mse * (1.0 / count[i] + 1.0 / count[j]));

			lsd = q * se;

			tval = d / se;

			pval = 2 * (1 - tdist(fabs(tval), dfe));

			snprintf(bigbuf, BIGBUFLEN, "%0.6f", d - lsd);
			A(k, 3) = strdup(bigbuf);

			snprintf(bigbuf, BIGBUFLEN, "%0.6f", d + lsd);
			A(k, 4) = strdup(bigbuf);

			// t Value

			snprintf(bigbuf, BIGBUFLEN, "%0.2f", tval);
			A(k, 5) = strdup(bigbuf);

			// Pr > |t|

			if (pval > alpha)
				snprintf(bigbuf, BIGBUFLEN, "%0.4f  ", pval);
			else
				snprintf(bigbuf, BIGBUFLEN, "%0.4f *", pval);
			A(k, 6) = strdup(bigbuf);
		}
	}

	bigbuf[0] = 1; // left justify
	bigbuf[1] = 1;
	bigbuf[2] = 0;
	bigbuf[3] = 0;
	bigbuf[4] = 0;
	bigbuf[5] = 0;
	bigbuf[6] = 0;

	print_table_and_free(a, nrow, ncol, bigbuf);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movl %edi, %ebx
leaq 0x6327(%rip), %rdi      # 0xb8dd
callq 0x4043
movl $0xa, %edi
callq 0x2050
movsd 0xe91b(%rip), %xmm0     # 0x13ee8
mulsd 0x5d2b(%rip), %xmm0     # 0xb300
addsd 0x5ceb(%rip), %xmm0     # 0xb2c8
movsd 0xf47b(%rip), %xmm1     # 0x14a60
callq 0x7aad
movsd %xmm0, -0x68(%rbp)
movq 0xe8e2(%rip), %rax      # 0x13ed8
movslq %ebx, %r12
leaq (,%r12,8), %rcx
leaq (%rcx,%rcx,4), %rbx
movslq 0x2c(%rax,%rbx), %r13
leal -0x1(%r13), %eax
imull %r13d, %eax
incl %eax
movl %eax, -0x44(%rbp)
imull $0x38, %eax, %edi
callq 0x2bd8
movq %rax, %r14
movq 0xe8af(%rip), %r15      # 0x13ed8
movq 0x20(%r15,%rbx), %rbx
movq %rbx, %rdi
callq 0x2220
movq %rax, (%r14)
movq %rbx, %rdi
callq 0x2220
movq %rax, 0x8(%r14)
movslq 0xef44(%rip), %rax      # 0x14590
leaq (%rax,%rax,4), %rax
movq 0x20(%r15,%rax,8), %rcx
leaq 0xd874(%rip), %rbx      # 0x12ed0
leaq 0x629c(%rip), %rdx      # 0xb8ff
movl $0xfa0, %esi            # imm = 0xFA0
movq %rbx, %rdi
xorl %eax, %eax
callq 0x20e0
movq %rbx, %rdi
callq 0x2220
movq %rax, 0x10(%r14)
movsd 0x5c42(%rip), %xmm0     # 0xb2c8
subsd 0xe85a(%rip), %xmm0     # 0x13ee8
mulsd 0x5c72(%rip), %xmm0     # 0xb308
leaq 0x6228(%rip), %rdx      # 0xb8c5
movl $0xfa0, %esi            # imm = 0xFA0
movq %rbx, %rdi
movb $0x1, %al
callq 0x20e0
movq %rbx, %rdi
callq 0x2220
movq %rax, 0x18(%r14)
movsd 0x5c08(%rip), %xmm0     # 0xb2c8
subsd 0xe820(%rip), %xmm0     # 0x13ee8
mulsd 0x5c38(%rip), %xmm0     # 0xb308
leaq 0x61fa(%rip), %rdx      # 0xb8d1
movl $0xfa0, %esi            # imm = 0xFA0
movq %rbx, %rdi
movb $0x1, %al
callq 0x20e0
movq %rbx, %rdi
callq 0x2220
movq %rax, 0x20(%r14)
leaq 0x620f(%rip), %rdi      # 0xb908
callq 0x2220
movq %rax, 0x28(%r14)
leaq 0x6207(%rip), %rdi      # 0xb910
callq 0x2220
xorl %edi, %edi
movq %rax, 0x30(%r14)
movq %r13, -0x50(%rbp)
testq %r13, %r13
jle 0x5a08
movq -0x50(%rbp), %rax
leaq (,%rax,8), %rax
leaq (%r12,%r12,4), %rcx
movq %rcx, -0x78(%rbp)
xorl %ecx, %ecx
movq $0x0, -0x30(%rbp)
movq %rax, -0x80(%rbp)
movq %r14, -0x58(%rbp)
leaq 0xfec2(%rip), %r15      # 0x15610
xorl %r13d, %r13d
movq %rcx, -0x88(%rbp)
cmpq %r13, %rcx
je 0x59de
leal 0x1(%rdi), %r12d
movq 0xe76c(%rip), %rax      # 0x13ed8
movq -0x78(%rbp), %rcx
movq 0x30(%rax,%rcx,8), %rbx
movq %r15, -0x90(%rbp)
movq -0x30(%rbp), %r15
movq %rdi, -0x40(%rbp)
movq (%rbx,%r15,8), %rdi
callq 0x2220
movq -0x40(%rbp), %rcx
leal 0x8(,%rcx,8), %ecx
movl %r12d, -0x40(%rbp)
subl %r12d, %ecx
movslq %ecx, %r12
movq %rax, (%r14,%r12,8)
movq (%rbx,%r13), %rdi
callq 0x2220
movq %rax, 0x8(%r14,%r12,8)
leaq 0xfe55(%rip), %rax      # 0x15610
cmpl $0x0, (%rax,%r15,4)
movq -0x90(%rbp), %r15
je 0x586b
cmpl $0x0, (%r15)
je 0x586b
leaq 0xf7f2(%rip), %rax      # 0x14fd0
movq -0x30(%rbp), %r14
movsd (%rax,%r14,8), %xmm0
subsd (%r13,%rax), %xmm0
movl $0xfa0, %esi            # imm = 0xFA0
leaq 0xd6d5(%rip), %rbx      # 0x12ed0
movq %rbx, %rdi
leaq 0x5b67(%rip), %rdx      # 0xb36c
movsd %xmm0, -0x38(%rbp)
movb $0x1, %al
callq 0x20e0
movq %rbx, %rdi
callq 0x2220
leaq 0xfdf0(%rip), %rcx      # 0x15610
xorps %xmm0, %xmm0
cvtsi2sdl (%rcx,%r14,4), %xmm0
movq -0x58(%rbp), %r14
movq %rax, 0x10(%r14,%r12,8)
movsd 0x5a8e(%rip), %xmm3     # 0xb2c8
movapd %xmm3, %xmm1
cvtsi2sdl (%r15), %xmm2
divsd %xmm0, %xmm1
movapd %xmm3, %xmm0
divsd %xmm2, %xmm0
addsd %xmm1, %xmm0
mulsd 0xf215(%rip), %xmm0     # 0x14a70
ucomisd 0x5aad(%rip), %xmm0     # 0xb310
jb 0x58b6
sqrtsd %xmm0, %xmm0
jmp 0x58bb
leaq 0x602b(%rip), %rbx      # 0xb89d
movq %rbx, %rdi
callq 0x2220
movq -0x58(%rbp), %r14
movq %rax, 0x10(%r14,%r12,8)
movq %rbx, %rdi
callq 0x2220
movq %rax, 0x18(%r14,%r12,8)
movq %rbx, %rdi
callq 0x2220
movq %rax, 0x20(%r14,%r12,8)
movq %rbx, %rdi
callq 0x2220
movq %rax, 0x28(%r14,%r12,8)
leaq 0x606a(%rip), %rdi      # 0xb91b
jmp 0x59c4
callq 0x2210
movsd -0x68(%rbp), %xmm1
mulsd %xmm0, %xmm1
movsd %xmm1, -0x60(%rbp)
movsd -0x38(%rbp), %xmm1
divsd %xmm0, %xmm1
movapd %xmm1, -0xa0(%rbp)
movapd %xmm1, %xmm0
andpd 0x59ba(%rip), %xmm0     # 0xb2a0
movsd 0xf172(%rip), %xmm1     # 0x14a60
callq 0x7c2b
movsd 0x59cd(%rip), %xmm1     # 0xb2c8
subsd %xmm0, %xmm1
addsd %xmm1, %xmm1
movsd %xmm1, -0x70(%rbp)
movsd -0x38(%rbp), %xmm0
subsd -0x60(%rbp), %xmm0
movl $0xfa0, %esi            # imm = 0xFA0
leaq 0xd5b2(%rip), %rbx      # 0x12ed0
movq %rbx, %rdi
leaq 0x5a44(%rip), %rdx      # 0xb36c
movb $0x1, %al
callq 0x20e0
movq %rbx, %rdi
callq 0x2220
movq %rax, 0x18(%r14,%r12,8)
movsd -0x60(%rbp), %xmm0
addsd -0x38(%rbp), %xmm0
movl $0xfa0, %esi            # imm = 0xFA0
movq %rbx, %rdi
leaq 0x5a17(%rip), %rdx      # 0xb36c
movb $0x1, %al
callq 0x20e0
movq %rbx, %rdi
callq 0x2220
movq %rax, 0x20(%r14,%r12,8)
movl $0xfa0, %esi            # imm = 0xFA0
movq %rbx, %rdi
leaq 0x59dc(%rip), %rdx      # 0xb354
movaps -0xa0(%rbp), %xmm0
movb $0x1, %al
callq 0x20e0
movq %rbx, %rdi
callq 0x2220
movq %rax, 0x28(%r14,%r12,8)
movsd -0x70(%rbp), %xmm0
ucomisd 0xe548(%rip), %xmm0     # 0x13ee8
leaq 0x5f80(%rip), %rdx      # 0xb927
leaq 0x5f71(%rip), %rax      # 0xb91f
cmovaq %rax, %rdx
movl $0xfa0, %esi            # imm = 0xFA0
movq %rbx, %rdi
movb $0x1, %al
callq 0x20e0
movq %rbx, %rdi
callq 0x2220
movq %rax, 0x30(%r14,%r12,8)
movl -0x40(%rbp), %eax
movl %eax, %edi
movq -0x80(%rbp), %rax
movq -0x88(%rbp), %rcx
addq $0x8, %r13
addq $0x4, %r15
cmpq %r13, %rax
jne 0x5758
movq -0x30(%rbp), %rsi
incq %rsi
addq $0x8, %rcx
movq %rsi, -0x30(%rbp)
cmpq -0x50(%rbp), %rsi
jne 0x5747
movw $0x101, 0xd4bf(%rip)    # imm = 0x101
leaq 0xd4b8(%rip), %rcx      # 0x12ed0
movl $0x0, 0xd4b0(%rip)      # 0x12ed2
movb $0x0, 0xd4ad(%rip)      # 0x12ed6
movq %r14, %rdi
movl -0x44(%rbp), %esi
movl $0x7, %edx
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x470d