// File: /workspace/github_c_makefile_star2_O1/georgeweigt[P]sassafras/sassafras.c
// Function: proc_anova_print_ttest
void
proc_anova_print_ttest(int x)
{
	int dfe, i, j, k, n, ncol, nrow;
	char **a, *s;
	double d, mse, pval, se, sse, t, tval;

	emit_line_center("Two Sample t-Test");
	emit_line("");

	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

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

			sse = variance[i] * (count[i] - 1) + variance[j] * (count[j] - 1);

			dfe = count[i] + count[j] - 2;

			mse = sse / dfe;

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

			tval = d / se;

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

			t = qt(1 - alpha / 2, dfe) * se;

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

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

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

			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 0x5ecf(%rip), %rdi      # 0xb95f
callq 0x408b
movl $0xa, %edi
callq 0x2050
movq 0xe422(%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, -0x4c(%rbp)
imull $0x38, %eax, %edi
callq 0x2bda
movq %rax, %r14
movq 0xe3ef(%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 0xea84(%rip), %rax      # 0x14580
leaq (%rax,%rax,4), %rax
movq 0x20(%r15,%rax,8), %rcx
leaq 0xd3b4(%rip), %r15      # 0x12ec0
leaq 0x5e1c(%rip), %rdx      # 0xb92f
movl $0xfa0, %esi            # imm = 0xFA0
movq %r15, %rdi
xorl %eax, %eax
callq 0x20e0
movq %r15, %rdi
callq 0x2210
movq %rax, 0x10(%r14)
movsd 0x57c2(%rip), %xmm0     # 0xb2f8
subsd 0xe39a(%rip), %xmm0     # 0x13ed8
mulsd 0x57f2(%rip), %xmm0     # 0xb338
leaq 0x5da8(%rip), %rdx      # 0xb8f5
movl $0xfa0, %esi            # imm = 0xFA0
movq %r15, %rdi
movb $0x1, %al
callq 0x20e0
movq %r15, %rdi
callq 0x2210
movq %rax, 0x18(%r14)
movsd 0x5788(%rip), %xmm0     # 0xb2f8
subsd 0xe360(%rip), %xmm0     # 0x13ed8
mulsd 0x57b8(%rip), %xmm0     # 0xb338
leaq 0x5d7a(%rip), %rdx      # 0xb901
movl $0xfa0, %esi            # imm = 0xFA0
movq %r15, %rdi
movb $0x1, %al
callq 0x20e0
movq %r15, %rdi
callq 0x2210
movq %rax, 0x20(%r14)
leaq 0x5d8f(%rip), %rdi      # 0xb938
callq 0x2210
movq %rax, 0x28(%r14)
leaq 0x5d87(%rip), %rdi      # 0xb940
callq 0x2210
xorl %ecx, %ecx
movq %rax, 0x30(%r14)
movq %r13, -0x58(%rbp)
testq %r13, %r13
jle 0x5f60
movq -0x58(%rbp), %rax
leaq (,%rax,8), %rax
leaq (%r12,%r12,4), %rdx
movq %rdx, -0x78(%rbp)
xorl %esi, %esi
xorl %edx, %edx
movq %rax, -0x80(%rbp)
movq %r14, -0x70(%rbp)
movq %rdx, -0x48(%rbp)
leaq 0xfa04(%rip), %r12      # 0x15600
xorl %r13d, %r13d
movl %ecx, %ebx
movq %rsi, -0x88(%rbp)
cmpq %r13, %rsi
jne 0x5c14
movl %ebx, %ecx
jmp 0x5f3a
leal 0x1(%rbx), %r14d
movq 0xe2a9(%rip), %rax      # 0x13ec8
movq -0x78(%rbp), %rcx
movq 0x30(%rax,%rcx,8), %r15
movq %r12, -0x38(%rbp)
movq -0x48(%rbp), %r12
movq (%r15,%r12,8), %rdi
callq 0x2210
leal 0x8(,%rbx,8), %ecx
movq %r14, -0x90(%rbp)
subl %r14d, %ecx
movq -0x70(%rbp), %r14
movslq %ecx, %rbx
movq %rax, (%r14,%rbx,8)
movq (%r15,%r13), %rdi
callq 0x2210
movq %rax, 0x8(%r14,%rbx,8)
leaq 0xf996(%rip), %rax      # 0x15600
cmpl $0x0, (%rax,%r12,4)
movq -0x38(%rbp), %r12
je 0x5d22
cmpl $0x0, (%r12)
je 0x5d22
leaq 0xf335(%rip), %rax      # 0x14fc0
movq -0x48(%rbp), %r12
movsd (%rax,%r12,8), %xmm0
subsd (%r13,%rax), %xmm0
movl $0xfa0, %esi            # imm = 0xFA0
leaq 0xd218(%rip), %r15      # 0x12ec0
movq %r15, %rdi
leaq 0x56ea(%rip), %rdx      # 0xb39c
movsd %xmm0, -0x40(%rbp)
movb $0x1, %al
callq 0x20e0
movq %r15, %rdi
callq 0x2210
movq %rax, 0x10(%r14,%rbx,8)
leaq 0xf92e(%rip), %rax      # 0x15600
movl (%rax,%r12,4), %ecx
movq -0x38(%rbp), %rax
movl (%rax), %eax
leal (%rax,%rcx), %edx
cmpl $0x2, %edx
jg 0x5d6e
leaq 0x5bde(%rip), %r15      # 0xb8cd
movq %r15, %rdi
callq 0x2210
movq %rax, 0x18(%r14,%rbx,8)
movq %r15, %rdi
callq 0x2210
movq %rax, 0x20(%r14,%rbx,8)
movq %r15, %rdi
callq 0x2210
movq %rax, 0x28(%r14,%rbx,8)
leaq 0x5c2e(%rip), %rdi      # 0xb94b
jmp 0x5f18
leaq 0x5ba4(%rip), %r15      # 0xb8cd
movq %r15, %rdi
callq 0x2210
movq %rax, 0x10(%r14,%rbx,8)
movq %r15, %rdi
callq 0x2210
movq %rax, 0x18(%r14,%rbx,8)
movq %r15, %rdi
callq 0x2210
movq %rax, 0x20(%r14,%rbx,8)
movq %r15, %rdi
callq 0x2210
movq %rax, 0x28(%r14,%rbx,8)
leaq 0x5be7(%rip), %rdi      # 0xb94b
callq 0x2210
jmp 0x5f21
leal -0x1(%rcx), %esi
cvtsi2sd %esi, %xmm1
leal -0x1(%rax), %esi
xorps %xmm0, %xmm0
cvtsi2sd %esi, %xmm0
leaq 0xf55a(%rip), %rsi      # 0x152e0
mulsd (%r13,%rsi), %xmm0
mulsd (%rsi,%r12,8), %xmm1
addsd %xmm0, %xmm1
addl $-0x2, %edx
xorps %xmm0, %xmm0
cvtsi2sd %edx, %xmm0
movsd %xmm0, -0x30(%rbp)
divsd %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtsi2sd %ecx, %xmm0
movsd 0x553f(%rip), %xmm4     # 0xb2f8
movapd %xmm4, %xmm2
divsd %xmm0, %xmm2
cvtsi2sd %eax, %xmm3
movapd %xmm4, %xmm0
divsd %xmm3, %xmm0
addsd %xmm2, %xmm0
mulsd %xmm1, %xmm0
ucomisd 0x5563(%rip), %xmm0     # 0xb340
jb 0x5de8
xorps %xmm1, %xmm1
sqrtsd %xmm0, %xmm1
jmp 0x5df1
callq 0x2200
movapd %xmm0, %xmm1
movsd %xmm1, -0x60(%rbp)
movsd -0x40(%rbp), %xmm0
divsd %xmm1, %xmm0
movapd %xmm0, -0xa0(%rbp)
andpd 0x54c1(%rip), %xmm0     # 0xb2d0
movsd -0x30(%rbp), %xmm1
callq 0x7bf4
movsd 0x54d7(%rip), %xmm1     # 0xb2f8
movapd %xmm1, %xmm2
subsd %xmm0, %xmm2
addsd %xmm2, %xmm2
movsd %xmm2, -0x68(%rbp)
movsd 0xe09e(%rip), %xmm0     # 0x13ed8
mulsd 0x54ee(%rip), %xmm0     # 0xb330
addsd %xmm1, %xmm0
movsd -0x30(%rbp), %xmm1
callq 0x7a76
movapd %xmm0, %xmm1
mulsd -0x60(%rbp), %xmm1
movsd %xmm1, -0x30(%rbp)
movsd -0x40(%rbp), %xmm0
subsd %xmm1, %xmm0
movl $0xfa0, %esi            # imm = 0xFA0
leaq 0xd04d(%rip), %r15      # 0x12ec0
movq %r15, %rdi
leaq 0x551f(%rip), %r12      # 0xb39c
movq %r12, %rdx
movb $0x1, %al
callq 0x20e0
movq %r15, %rdi
callq 0x2210
movq %rax, 0x18(%r14,%rbx,8)
movsd -0x30(%rbp), %xmm0
addsd -0x40(%rbp), %xmm0
movl $0xfa0, %esi            # imm = 0xFA0
movq %r15, %rdi
movq %r12, %rdx
movb $0x1, %al
callq 0x20e0
movq %r15, %rdi
callq 0x2210
movq %rax, 0x20(%r14,%rbx,8)
movl $0xfa0, %esi            # imm = 0xFA0
movq %r15, %rdi
leaq 0x54b8(%rip), %rdx      # 0xb384
movaps -0xa0(%rbp), %xmm0
movb $0x1, %al
callq 0x20e0
movq %r15, %rdi
callq 0x2210
movq %rax, 0x28(%r14,%rbx,8)
movsd -0x68(%rbp), %xmm0
ucomisd 0xdfe4(%rip), %xmm0     # 0x13ed8
leaq 0x5a5c(%rip), %rdx      # 0xb957
leaq 0x5a4d(%rip), %rax      # 0xb94f
cmovaq %rax, %rdx
movl $0xfa0, %esi            # imm = 0xFA0
movq %r15, %rdi
movb $0x1, %al
callq 0x20e0
movq %r15, %rdi
callq 0x2210
movq -0x38(%rbp), %r12
movq %rax, 0x30(%r14,%rbx,8)
movq -0x90(%rbp), %rcx
movl %ecx, %ebx
movq -0x80(%rbp), %rax
movq -0x88(%rbp), %rsi
addq $0x8, %r13
addq $0x4, %r12
cmpq %r13, %rax
jne 0x5c08
movq -0x48(%rbp), %rdx
incq %rdx
addq $0x8, %rsi
cmpq -0x58(%rbp), %rdx
jne 0x5bf1
movw $0x101, 0xcf57(%rip)    # imm = 0x101
leaq 0xcf50(%rip), %rcx      # 0x12ec0
movl $0x0, 0xcf48(%rip)      # 0x12ec2
movb $0x0, 0xcf45(%rip)      # 0x12ec6
movq %r14, %rdi
movl -0x4c(%rbp), %esi
movl $0x7, %edx
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4767