// File: /workspace/github_c_makefile_star2_O2/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 0x6752(%rip), %rdi      # 0xb8dd
callq 0x3df6
pushq $0xa
popq %rdi
callq 0x2050
movsd 0xed38(%rip), %xmm0     # 0x13ed8
mulsd 0x6158(%rip), %xmm0     # 0xb300
addsd 0x6118(%rip), %xmm0     # 0xb2c8
movsd 0xf898(%rip), %xmm1     # 0x14a50
callq 0x74c5
movsd %xmm0, -0x70(%rbp)
movq 0xecff(%rip), %rax      # 0x13ec8
movslq %ebx, %rcx
imulq $0x28, %rcx, %r15
movl 0x2c(%rax,%r15), %r12d
leal -0x1(%r12), %eax
imull %r12d, %eax
incl %eax
movl %eax, -0x4c(%rbp)
imull $0x38, %eax, %edi
callq 0x2a9b
movq %rax, %r14
movq 0xecd3(%rip), %rbx      # 0x13ec8
movq %r15, -0x88(%rbp)
movq 0x20(%rbx,%r15), %r15
movq %r15, %rdi
callq 0x2210
movq %rax, (%r14)
movq %r15, %rdi
callq 0x2210
movq %rax, 0x8(%r14)
movslq 0xf361(%rip), %rax      # 0x14580
imulq $0x28, %rax, %rax
movq 0x20(%rbx,%rax), %rcx
leaq 0xdc91(%rip), %rbx      # 0x12ec0
leaq 0x66c9(%rip), %rdx      # 0xb8ff
movl $0xfa0, %esi            # imm = 0xFA0
movq %rbx, %rdi
xorl %eax, %eax
callq 0x20e0
movq %rbx, %rdi
callq 0x2210
movq %rax, 0x10(%r14)
movsd 0x606f(%rip), %xmm0     # 0xb2c8
subsd 0xec77(%rip), %xmm0     # 0x13ed8
mulsd 0x609f(%rip), %xmm0     # 0xb308
leaq 0x6655(%rip), %rdx      # 0xb8c5
movl $0xfa0, %esi            # imm = 0xFA0
movq %rbx, %rdi
movb $0x1, %al
callq 0x20e0
movq %rbx, %rdi
callq 0x2210
movq %rax, 0x18(%r14)
movsd 0x6035(%rip), %xmm0     # 0xb2c8
subsd 0xec3d(%rip), %xmm0     # 0x13ed8
mulsd 0x6065(%rip), %xmm0     # 0xb308
leaq 0x6627(%rip), %rdx      # 0xb8d1
movl $0xfa0, %esi            # imm = 0xFA0
movq %rbx, %rdi
movb $0x1, %al
callq 0x20e0
movq %rbx, %rdi
callq 0x2210
movq %rax, 0x20(%r14)
leaq 0x663c(%rip), %rdi      # 0xb908
callq 0x2210
movq %rax, 0x28(%r14)
leaq 0x6634(%rip), %rdi      # 0xb910
callq 0x2210
movq %rax, 0x30(%r14)
xorl %eax, %eax
testl %r12d, %r12d
movl $0x0, %ecx
cmovgl %r12d, %ecx
movq %rcx, -0x68(%rbp)
shlq $0x3, %r12
xorl %ecx, %ecx
movl $0x0, -0x2c(%rbp)
movq %r12, -0x80(%rbp)
movq %r14, -0x58(%rbp)
cmpq -0x68(%rbp), %rcx
je 0x55ce
movq %rcx, -0x38(%rbp)
leaq 0x102df(%rip), %r15     # 0x15600
xorl %edx, %edx
movq %rax, -0x90(%rbp)
cmpq %rdx, %r12
je 0x55be
cmpq %rdx, %rax
je 0x55b1
movl -0x2c(%rbp), %r12d
incl %r12d
movq 0xeb7e(%rip), %rax      # 0x13ec8
movq -0x88(%rbp), %rcx
movq %rdx, -0x48(%rbp)
movq 0x30(%rax,%rcx), %rbx
movq %r15, %r13
movq %r14, %r15
movq -0x38(%rbp), %r14
movq (%rbx,%r14,8), %rdi
callq 0x2210
movl %r12d, -0x2c(%rbp)
imull $0x7, %r12d, %ecx
movslq %ecx, %r12
movq %rax, (%r15,%r12,8)
movq -0x48(%rbp), %rax
movq (%rbx,%rax), %rdi
movq -0x48(%rbp), %rbx
callq 0x2210
movq %rax, 0x8(%r15,%r12,8)
movq %r13, %r15
leaq 0x10264(%rip), %rax     # 0x15600
cmpl $0x0, (%rax,%r14,4)
je 0x5440
cmpl $0x0, (%r15)
je 0x5440
leaq 0xfc08(%rip), %rax      # 0x14fc0
movq -0x38(%rbp), %r14
movsd (%rax,%r14,8), %xmm0
subsd (%rbx,%rax), %xmm0
movl $0xfa0, %esi            # imm = 0xFA0
leaq 0xdaed(%rip), %rbx      # 0x12ec0
movq %rbx, %rdi
leaq 0x5f8f(%rip), %rdx      # 0xb36c
movsd %xmm0, -0x40(%rbp)
movb $0x1, %al
callq 0x20e0
movq %rbx, %rdi
callq 0x2210
leaq 0x10208(%rip), %rcx     # 0x15600
cvtsi2sdl (%rcx,%r14,4), %xmm0
movq -0x58(%rbp), %r14
movq %rax, 0x10(%r14,%r12,8)
movsd 0x5eb9(%rip), %xmm3     # 0xb2c8
movapd %xmm3, %xmm1
cvtsi2sdl (%r15), %xmm2
divsd %xmm0, %xmm1
movapd %xmm3, %xmm0
divsd %xmm2, %xmm0
addsd %xmm1, %xmm0
mulsd 0xf630(%rip), %xmm0     # 0x14a60
ucomisd 0x5ed8(%rip), %xmm0     # 0xb310
jb 0x548b
sqrtsd %xmm0, %xmm0
jmp 0x5490
leaq 0x6456(%rip), %rbx      # 0xb89d
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 0x6495(%rip), %rdi      # 0xb91b
jmp 0x5598
callq 0x2200
movsd -0x70(%rbp), %xmm1
mulsd %xmm0, %xmm1
movsd %xmm1, -0x60(%rbp)
movsd -0x40(%rbp), %xmm1
divsd %xmm0, %xmm1
movapd %xmm1, -0xa0(%rbp)
movapd %xmm1, %xmm0
andpd 0x5de5(%rip), %xmm0     # 0xb2a0
movsd 0xf58d(%rip), %xmm1     # 0x14a50
callq 0x763a
movsd 0x5df8(%rip), %xmm1     # 0xb2c8
subsd %xmm0, %xmm1
addsd %xmm1, %xmm1
movsd %xmm1, -0x78(%rbp)
movsd -0x40(%rbp), %xmm0
subsd -0x60(%rbp), %xmm0
movl $0xfa0, %esi            # imm = 0xFA0
leaq 0xd9cd(%rip), %rbx      # 0x12ec0
movq %rbx, %rdi
leaq 0x5e6f(%rip), %r13      # 0xb36c
movq %r13, %rdx
movb $0x1, %al
callq 0x20e0
movq %rbx, %rdi
callq 0x2210
movq %rax, 0x18(%r14,%r12,8)
movsd -0x60(%rbp), %xmm0
addsd -0x40(%rbp), %xmm0
movl $0xfa0, %esi            # imm = 0xFA0
movq %rbx, %rdi
movq %r13, %rdx
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 0x5e08(%rip), %rdx      # 0xb354
movaps -0xa0(%rbp), %xmm0
movb $0x1, %al
callq 0x20e0
movq %rbx, %rdi
callq 0x2210
movq %rax, 0x28(%r14,%r12,8)
movsd -0x78(%rbp), %xmm0
ucomisd 0xe964(%rip), %xmm0     # 0x13ed8
leaq 0x63ac(%rip), %rdx      # 0xb927
leaq 0x639d(%rip), %rax      # 0xb91f
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)
movq -0x80(%rbp), %r12
movq -0x90(%rbp), %rax
movq -0x48(%rbp), %rdx
addq $0x8, %rdx
addq $0x4, %r15
jmp 0x532a
movq -0x38(%rbp), %rcx
incq %rcx
addq $0x8, %rax
jmp 0x530c
movw $0x101, 0xd8e9(%rip)    # imm = 0x101
andl $0x0, 0xd8e4(%rip)      # 0x12ec2
leaq 0xd8db(%rip), %rcx      # 0x12ec0
movb $0x0, 0xd8da(%rip)      # 0x12ec6
pushq $0x7
popq %rdx
movq %r14, %rdi
movl -0x4c(%rbp), %esi
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4411