// File: /workspace/github_c_makefile_star2_O2/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 0x630d(%rip), %rdi      # 0xb92f
callq 0x3df6
pushq $0xa
popq %rdi
callq 0x2050
movq 0xe892(%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, -0x5c(%rbp)
imull $0x38, %eax, %edi
callq 0x2a9b
movq %rax, %r14
movq 0xe866(%rip), %rbx      # 0x13ec8
movq %r15, -0x98(%rbp)
movq 0x20(%rbx,%r15), %r15
movq %r15, %rdi
callq 0x2210
movq %rax, (%r14)
movq %r15, %rdi
callq 0x2210
movq %rax, 0x8(%r14)
movslq 0xeef4(%rip), %rax      # 0x14580
imulq $0x28, %rax, %rax
movq 0x20(%rbx,%rax), %rcx
leaq 0xd824(%rip), %rbx      # 0x12ec0
leaq 0x625c(%rip), %rdx      # 0xb8ff
xorl %r15d, %r15d
movl $0xfa0, %esi            # imm = 0xFA0
movq %rbx, %rdi
xorl %eax, %eax
callq 0x20e0
movq %rbx, %rdi
callq 0x2210
movq %rax, 0x10(%r14)
movsd 0x5bff(%rip), %xmm0     # 0xb2c8
subsd 0xe807(%rip), %xmm0     # 0x13ed8
mulsd 0x5c2f(%rip), %xmm0     # 0xb308
leaq 0x61e5(%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 0x5bc5(%rip), %xmm0     # 0xb2c8
subsd 0xe7cd(%rip), %xmm0     # 0x13ed8
mulsd 0x5bf5(%rip), %xmm0     # 0xb308
leaq 0x61b7(%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 0x61cc(%rip), %rdi      # 0xb908
callq 0x2210
movq %rax, 0x28(%r14)
leaq 0x61c4(%rip), %rdi      # 0xb910
callq 0x2210
testl %r12d, %r12d
movl $0x0, %ecx
cmovgl %r12d, %ecx
movq %rcx, -0x78(%rbp)
movq %rax, 0x30(%r14)
shlq $0x3, %r12
xorl %eax, %eax
movl $0x0, -0x2c(%rbp)
movq %r12, -0x90(%rbp)
movq %r14, -0x40(%rbp)
cmpq -0x78(%rbp), %rax
je 0x5ae8
movq %rax, -0x58(%rbp)
leaq 0xfe6e(%rip), %r13      # 0x15600
xorl %ebx, %ebx
movq %r15, -0x50(%rbp)
cmpq %rbx, %r12
je 0x5ad8
cmpq %rbx, %r15
je 0x5acb
movl -0x2c(%rbp), %r12d
incl %r12d
movq 0xe710(%rip), %rax      # 0x13ec8
movq -0x98(%rbp), %rcx
movq 0x30(%rax,%rcx), %r15
movq %r13, -0x70(%rbp)
movq %r14, %r13
movq -0x58(%rbp), %r14
movq (%r15,%r14,8), %rdi
callq 0x2210
movl %r12d, -0x2c(%rbp)
imull $0x7, %r12d, %ecx
movslq %ecx, %r12
movq %rax, (%r13,%r12,8)
movq (%r15,%rbx), %rdi
callq 0x2210
movq %rax, 0x8(%r13,%r12,8)
movq -0x70(%rbp), %r13
leaq 0xfdff(%rip), %rax      # 0x15600
cmpl $0x0, (%rax,%r14,4)
je 0x58c6
cmpl $0x0, (%r13)
je 0x58c6
leaq 0xf7a2(%rip), %rax      # 0x14fc0
movq -0x58(%rbp), %r14
movsd (%rax,%r14,8), %xmm0
subsd (%rbx,%rax), %xmm0
movl $0xfa0, %esi            # imm = 0xFA0
leaq 0xd687(%rip), %r15      # 0x12ec0
movq %r15, %rdi
leaq 0x5b29(%rip), %rdx      # 0xb36c
movsd %xmm0, -0x48(%rbp)
movb $0x1, %al
callq 0x20e0
movq %r15, %rdi
callq 0x2210
movq %r13, %rdx
movq -0x40(%rbp), %r13
movq %rax, 0x10(%r13,%r12,8)
leaq 0xfd96(%rip), %rax      # 0x15600
movl (%rax,%r14,4), %ecx
movl (%rdx), %eax
leal (%rax,%rcx), %edx
cmpl $0x2, %edx
jg 0x5911
leaq 0x601a(%rip), %r15      # 0xb89d
movq %r15, %rdi
callq 0x2210
movq %rax, 0x18(%r13,%r12,8)
movq %r15, %rdi
callq 0x2210
movq %rax, 0x20(%r13,%r12,8)
movq %r15, %rdi
callq 0x2210
movq %rax, 0x28(%r13,%r12,8)
leaq 0x606a(%rip), %rdi      # 0xb91b
callq 0x2210
movq -0x50(%rbp), %r15
movq %r13, %r14
movq -0x70(%rbp), %r13
jmp 0x5abf
leaq 0x5fd0(%rip), %r15      # 0xb89d
movq %r15, %rdi
callq 0x2210
movq -0x40(%rbp), %r14
movq %rax, 0x10(%r14,%r12,8)
movq %r15, %rdi
callq 0x2210
movq %rax, 0x18(%r14,%r12,8)
movq %r15, %rdi
callq 0x2210
movq %rax, 0x20(%r14,%r12,8)
movq %r15, %rdi
callq 0x2210
movq %rax, 0x28(%r14,%r12,8)
leaq 0x600f(%rip), %rdi      # 0xb91b
jmp 0x5ab6
leal -0x1(%rcx), %esi
cvtsi2sd %esi, %xmm5
leal -0x1(%rax), %esi
cvtsi2sd %esi, %xmm0
leaq 0xf9ba(%rip), %rsi      # 0x152e0
mulsd (%rbx,%rsi), %xmm0
mulsd (%rsi,%r14,8), %xmm5
addsd %xmm0, %xmm5
addl $-0x2, %edx
cvtsi2sd %edx, %xmm1
divsd %xmm1, %xmm5
cvtsi2sd %ecx, %xmm0
movsd 0x597c(%rip), %xmm4     # 0xb2c8
movapd %xmm4, %xmm2
divsd %xmm0, %xmm2
cvtsi2sd %eax, %xmm3
movapd %xmm4, %xmm0
divsd %xmm3, %xmm0
addsd %xmm2, %xmm0
mulsd %xmm5, %xmm0
ucomisd 0x59a0(%rip), %xmm0     # 0xb310
movsd %xmm1, -0x38(%rbp)
jb 0x597d
sqrtsd %xmm0, %xmm2
jmp 0x598b
callq 0x2200
movsd -0x38(%rbp), %xmm1
movapd %xmm0, %xmm2
movq -0x40(%rbp), %r14
movq -0x70(%rbp), %r13
movsd %xmm2, -0x80(%rbp)
movsd -0x48(%rbp), %xmm0
divsd %xmm2, %xmm0
movapd %xmm0, -0x70(%rbp)
andpd 0x58f2(%rip), %xmm0     # 0xb2a0
callq 0x763a
movsd 0x590d(%rip), %xmm1     # 0xb2c8
movapd %xmm1, %xmm2
subsd %xmm0, %xmm2
addsd %xmm2, %xmm2
movsd %xmm2, -0x88(%rbp)
movsd 0xe501(%rip), %xmm0     # 0x13ed8
mulsd 0x5921(%rip), %xmm0     # 0xb300
addsd %xmm1, %xmm0
movsd -0x38(%rbp), %xmm1
callq 0x74c5
movapd %xmm0, %xmm1
mulsd -0x80(%rbp), %xmm1
movsd %xmm1, -0x38(%rbp)
movsd -0x48(%rbp), %xmm0
subsd %xmm1, %xmm0
movl $0xfa0, %esi            # imm = 0xFA0
leaq 0xd4b0(%rip), %r15      # 0x12ec0
movq %r15, %rdi
leaq 0x5952(%rip), %rdx      # 0xb36c
movb $0x1, %al
callq 0x20e0
movq %r15, %rdi
callq 0x2210
movq %rax, 0x18(%r14,%r12,8)
movsd -0x38(%rbp), %xmm0
addsd -0x48(%rbp), %xmm0
movl $0xfa0, %esi            # imm = 0xFA0
movq %r15, %rdi
leaq 0x5925(%rip), %rdx      # 0xb36c
movb $0x1, %al
callq 0x20e0
movq %r15, %rdi
callq 0x2210
movq %rax, 0x20(%r14,%r12,8)
movl $0xfa0, %esi            # imm = 0xFA0
movq %r15, %rdi
leaq 0x58ea(%rip), %rdx      # 0xb354
movaps -0x70(%rbp), %xmm0
movb $0x1, %al
callq 0x20e0
movq %r15, %rdi
callq 0x2210
movq %rax, 0x28(%r14,%r12,8)
movsd -0x88(%rbp), %xmm0
ucomisd 0xe446(%rip), %xmm0     # 0x13ed8
leaq 0x5e8e(%rip), %rdx      # 0xb927
leaq 0x5e7f(%rip), %rax      # 0xb91f
cmovaq %rax, %rdx
movl $0xfa0, %esi            # imm = 0xFA0
movq %r15, %rdi
movb $0x1, %al
callq 0x20e0
movq %r15, %rdi
callq 0x2210
movq -0x50(%rbp), %r15
movq %rax, 0x30(%r14,%r12,8)
movq -0x90(%rbp), %r12
addq $0x8, %rbx
addq $0x4, %r13
jmp 0x5798
movq -0x58(%rbp), %rax
incq %rax
addq $0x8, %r15
jmp 0x577d
movw $0x101, 0xd3cf(%rip)    # imm = 0x101
andl $0x0, 0xd3ca(%rip)      # 0x12ec2
leaq 0xd3c1(%rip), %rcx      # 0x12ec0
movb $0x0, 0xd3c0(%rip)      # 0x12ec6
pushq $0x7
popq %rdx
movq %r14, %rdi
movl -0x5c(%rbp), %esi
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4411