// File: /workspace/github_c_makefile_star2_O1/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 0x6328(%rip), %rdi      # 0xb90d
callq 0x408b
movl $0xa, %edi
callq 0x2050
movsd 0xe8dc(%rip), %xmm0     # 0x13ed8
mulsd 0x5d2c(%rip), %xmm0     # 0xb330
addsd 0x5cec(%rip), %xmm0     # 0xb2f8
movsd 0xf43c(%rip), %xmm1     # 0x14a50
callq 0x7a76
movsd %xmm0, -0x68(%rbp)
movq 0xe8a3(%rip), %rax      # 0x13ec8
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 0x2bda
movq %rax, %r14
movq 0xe870(%rip), %r15      # 0x13ec8
movq 0x20(%r15,%rbx), %rbx
movq %rbx, %rdi
callq 0x2210
movq %rax, (%r14)
movq %rbx, %rdi
callq 0x2210
movq %rax, 0x8(%r14)
movslq 0xef05(%rip), %rax      # 0x14580
leaq (%rax,%rax,4), %rax
movq 0x20(%r15,%rax,8), %rcx
leaq 0xd835(%rip), %rbx      # 0x12ec0
leaq 0x629d(%rip), %rdx      # 0xb92f
movl $0xfa0, %esi            # imm = 0xFA0
movq %rbx, %rdi
xorl %eax, %eax
callq 0x20e0
movq %rbx, %rdi
callq 0x2210
movq %rax, 0x10(%r14)
movsd 0x5c43(%rip), %xmm0     # 0xb2f8
subsd 0xe81b(%rip), %xmm0     # 0x13ed8
mulsd 0x5c73(%rip), %xmm0     # 0xb338
leaq 0x6229(%rip), %rdx      # 0xb8f5
movl $0xfa0, %esi            # imm = 0xFA0
movq %rbx, %rdi
movb $0x1, %al
callq 0x20e0
movq %rbx, %rdi
callq 0x2210
movq %rax, 0x18(%r14)
movsd 0x5c09(%rip), %xmm0     # 0xb2f8
subsd 0xe7e1(%rip), %xmm0     # 0x13ed8
mulsd 0x5c39(%rip), %xmm0     # 0xb338
leaq 0x61fb(%rip), %rdx      # 0xb901
movl $0xfa0, %esi            # imm = 0xFA0
movq %rbx, %rdi
movb $0x1, %al
callq 0x20e0
movq %rbx, %rdi
callq 0x2210
movq %rax, 0x20(%r14)
leaq 0x6210(%rip), %rdi      # 0xb938
callq 0x2210
movq %rax, 0x28(%r14)
leaq 0x6208(%rip), %rdi      # 0xb940
callq 0x2210
xorl %edi, %edi
movq %rax, 0x30(%r14)
movq %r13, -0x50(%rbp)
testq %r13, %r13
jle 0x5a37
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 0xfe83(%rip), %r15      # 0x15600
xorl %r13d, %r13d
movq %rcx, -0x88(%rbp)
cmpq %r13, %rcx
je 0x5a0d
leal 0x1(%rdi), %r12d
movq 0xe72d(%rip), %rax      # 0x13ec8
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 0x2210
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 0x2210
movq %rax, 0x8(%r14,%r12,8)
leaq 0xfe16(%rip), %rax      # 0x15600
cmpl $0x0, (%rax,%r15,4)
movq -0x90(%rbp), %r15
je 0x589a
cmpl $0x0, (%r15)
je 0x589a
leaq 0xf7b3(%rip), %rax      # 0x14fc0
movq -0x30(%rbp), %r14
movsd (%rax,%r14,8), %xmm0
subsd (%r13,%rax), %xmm0
movl $0xfa0, %esi            # imm = 0xFA0
leaq 0xd696(%rip), %rbx      # 0x12ec0
movq %rbx, %rdi
leaq 0x5b68(%rip), %rdx      # 0xb39c
movsd %xmm0, -0x38(%rbp)
movb $0x1, %al
callq 0x20e0
movq %rbx, %rdi
callq 0x2210
leaq 0xfdb1(%rip), %rcx      # 0x15600
xorps %xmm0, %xmm0
cvtsi2sdl (%rcx,%r14,4), %xmm0
movq -0x58(%rbp), %r14
movq %rax, 0x10(%r14,%r12,8)
movsd 0x5a8f(%rip), %xmm3     # 0xb2f8
movapd %xmm3, %xmm1
cvtsi2sdl (%r15), %xmm2
divsd %xmm0, %xmm1
movapd %xmm3, %xmm0
divsd %xmm2, %xmm0
addsd %xmm1, %xmm0
mulsd 0xf1d6(%rip), %xmm0     # 0x14a60
ucomisd 0x5aae(%rip), %xmm0     # 0xb340
jb 0x58e5
sqrtsd %xmm0, %xmm0
jmp 0x58ea
leaq 0x602c(%rip), %rbx      # 0xb8cd
movq %rbx, %rdi
callq 0x2210
movq -0x58(%rbp), %r14
movq %rax, 0x10(%r14,%r12,8)
movq %rbx, %rdi
callq 0x2210
movq %rax, 0x18(%r14,%r12,8)
movq %rbx, %rdi
callq 0x2210
movq %rax, 0x20(%r14,%r12,8)
movq %rbx, %rdi
callq 0x2210
movq %rax, 0x28(%r14,%r12,8)
leaq 0x606b(%rip), %rdi      # 0xb94b
jmp 0x59f3
callq 0x2200
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 0x59bb(%rip), %xmm0     # 0xb2d0
movsd 0xf133(%rip), %xmm1     # 0x14a50
callq 0x7bf4
movsd 0x59ce(%rip), %xmm1     # 0xb2f8
subsd %xmm0, %xmm1
addsd %xmm1, %xmm1
movsd %xmm1, -0x70(%rbp)
movsd -0x38(%rbp), %xmm0
subsd -0x60(%rbp), %xmm0
movl $0xfa0, %esi            # imm = 0xFA0
leaq 0xd573(%rip), %rbx      # 0x12ec0
movq %rbx, %rdi
leaq 0x5a45(%rip), %rdx      # 0xb39c
movb $0x1, %al
callq 0x20e0
movq %rbx, %rdi
callq 0x2210
movq %rax, 0x18(%r14,%r12,8)
movsd -0x60(%rbp), %xmm0
addsd -0x38(%rbp), %xmm0
movl $0xfa0, %esi            # imm = 0xFA0
movq %rbx, %rdi
leaq 0x5a18(%rip), %rdx      # 0xb39c
movb $0x1, %al
callq 0x20e0
movq %rbx, %rdi
callq 0x2210
movq %rax, 0x20(%r14,%r12,8)
movl $0xfa0, %esi            # imm = 0xFA0
movq %rbx, %rdi
leaq 0x59dd(%rip), %rdx      # 0xb384
movaps -0xa0(%rbp), %xmm0
movb $0x1, %al
callq 0x20e0
movq %rbx, %rdi
callq 0x2210
movq %rax, 0x28(%r14,%r12,8)
movsd -0x70(%rbp), %xmm0
ucomisd 0xe509(%rip), %xmm0     # 0x13ed8
leaq 0x5f81(%rip), %rdx      # 0xb957
leaq 0x5f72(%rip), %rax      # 0xb94f
cmovaq %rax, %rdx
movl $0xfa0, %esi            # imm = 0xFA0
movq %rbx, %rdi
movb $0x1, %al
callq 0x20e0
movq %rbx, %rdi
callq 0x2210
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 0x5787
movq -0x30(%rbp), %rsi
incq %rsi
addq $0x8, %rcx
movq %rsi, -0x30(%rbp)
cmpq -0x50(%rbp), %rsi
jne 0x5776
movw $0x101, 0xd480(%rip)    # imm = 0x101
leaq 0xd479(%rip), %rcx      # 0x12ec0
movl $0x0, 0xd471(%rip)      # 0x12ec2
movb $0x0, 0xd46e(%rip)      # 0x12ec6
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 0x4767