// File: /workspace/github_c_makefile_star2_O2/georgeweigt[P]sassafras/sassafras.c
// Function: run_proc_means
void
run_proc_means(void)
{
	int i, j, k, n;
	char *t;
	char buf[100];

	// print all numeric variables if not specified with VAR

	if (nvar == 0) {
		k = 0;
		for (i = 0; i < dataset->nvar; i++)
			if (dataset->spec[i].ltab == NULL)
				var[k++] = i;
		nvar = k;
	}

	// default statistics

	if (nstats == 0) {
		nstats = 5;
		stats[0] = KN;
		stats[1] = KMEAN;
		stats[2] = KSTD;
		stats[3] = KMIN;
		stats[4] = KMAX;
	}

	ncol = nclass + nstats + 1;

	nrow = nvar;

	for (i = 0; i < nclass; i++) {
		k = class[i];
		n = dataset->spec[k].num_levels;
		nrow *= n;
	}

	nrow++; // for header row

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

	// table header line

	// categorical variable names, if any

	for (i = 0; i < nclass; i++) {
		k = class[i];
		t = dataset->spec[k].name;
		A(0, i) = strdup(t);
	}

	// variable name column

	A(0, nclass) = strdup("Variable");

	// statistic names

	for (i = 0; i < nstats; i++) {
		switch (stats[i]) {
		case KCLM1:
			snprintf(buf, sizeof buf, "%g%% CLM MIN", 100 * (1 - alpha));
			t = buf;
			break;
		case KCLM2:
			snprintf(buf, sizeof buf, "%g%% CLM MAX", 100 * (1 - alpha));
			t = buf;
			break;
		case KLCLM:
			snprintf(buf, sizeof buf, "%g%% LCLM", 100 * (1 - alpha));
			t = buf;
			break;
		case KMAX:
			t = "Maximum";
			break;
		case KMEAN:
			t = "Mean";
			break;
		case KMIN:
			t = "Minimum";
			break;
		case KN:
			t = "N";
			break;
		case KRANGE:
			t = "Range";
			break;
		case KSUM:
			t = "Sum";
			break;
		case KSTD:
		case KSTDDEV:
			t = "Std Dev";
			break;
		case KSTDERR:
		case KSTDMEAN:
			t = "Std Err";
			break;
		case KUCLM:
			snprintf(buf, sizeof buf, "%g%% UCLM", 100 * (1 - alpha));
			t = buf;
			break;
		case KVAR:
			t = "Variance";
			break;
		default:
			t = ".";
			break;
		}
		A(0, nclass + 1 + i) = strdup(t);
	}

	row = 1;

	f(0);

	// right justify variable names

	for (i = 0; i < ncol; i++) {
		if (i < nclass + 1)
			tblfmt[i] = 1;
		else
			tblfmt[i] = 0;
	}

	print_table(a, nrow, ncol, tblfmt);

	for (i = 0; i < nrow; i++)
		for (j = 0; j < ncol; j++)
			free(A(i, j));

	free(a);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movl 0xcadf(%rip), %eax      # 0x143c0
testl %eax, %eax
jne 0x7922
movq 0xc5dc(%rip), %rcx      # 0x13ec8
leaq 0x30(%rcx), %rdx
xorl %esi, %esi
leaq 0xc937(%rip), %rdi      # 0x14230
xorl %eax, %eax
movslq 0x10(%rcx), %r8
cmpq %r8, %rsi
jge 0x791c
cmpq $0x0, (%rdx)
jne 0x7913
movslq %eax, %r8
incl %eax
movl %esi, (%rdi,%r8,4)
incq %rsi
addq $0x28, %rdx
jmp 0x78fb
movl %eax, 0xca9e(%rip)      # 0x143c0
movl 0xde68(%rip), %edx      # 0x15790
testl %edx, %edx
jne 0x7953
movl $0x5, 0xde5a(%rip)      # 0x15790
movapd 0x3972(%rip), %xmm0     # 0xb2b0
movapd %xmm0, 0xde5a(%rip)     # 0x157a0
movl $0x13e, 0xde60(%rip)    # imm = 0x13E
pushq $0x5
popq %rdx
movl 0xc8c7(%rip), %ecx      # 0x14220
leal (%rcx,%rdx), %edi
incl %edi
movl %edi, 0xd18c(%rip)      # 0x14af0
movl %eax, 0xde66(%rip)      # 0x157d0
movq 0xc557(%rip), %rdx      # 0x13ec8
addq $0x20, %rdx
xorl %esi, %esi
testl %ecx, %ecx
cmovlel %esi, %ecx
shlq $0x2, %rcx
leaq 0xc709(%rip), %r14      # 0x14090
cmpq %rsi, %rcx
je 0x79a6
movslq (%rsi,%r14), %r8
imulq $0x28, %r8, %r8
imull 0xc(%rdx,%r8), %eax
movl %eax, 0xde30(%rip)      # 0x157d0
addq $0x4, %rsi
jmp 0x7987
incl %eax
movl %eax, 0xde22(%rip)      # 0x157d0
imull %eax, %edi
shll $0x3, %edi
callq 0x2a9b
movq %rax, 0xde18(%rip)      # 0x157d8
movl 0xc85a(%rip), %ebx      # 0x14220
xorl %r15d, %r15d
testl %ebx, %ebx
movl $0x0, %r12d
cmovgl %ebx, %r12d
shlq $0x2, %r12
cmpq %r15, %r12
je 0x7a08
movslq (%r15,%r14), %rax
movq 0xc4df(%rip), %rcx      # 0x13ec8
imulq $0x28, %rax, %rax
movq 0x20(%rcx,%rax), %rdi
callq 0x2210
movq 0xddda(%rip), %rcx      # 0x157d8
movq %rax, (%rcx,%r15,2)
addq $0x4, %r15
jmp 0x79d9
leaq 0x3f61(%rip), %rdi      # 0xb970
callq 0x2210
leaq 0xdd85(%rip), %r12      # 0x157a0
xorl %r13d, %r13d
movl $0xfffffecd, %r15d      # imm = 0xFFFFFECD
leaq 0x36f1(%rip), %r14      # 0xb11c
movq 0xdda6(%rip), %rcx      # 0x157d8
movslq %ebx, %rdx
movq %rax, (%rcx,%rdx,8)
movslq 0xdd50(%rip), %rax      # 0x15790
cmpq %rax, %r13
jge 0x7ba6
movl (%r12), %eax
addl %r15d, %eax
cmpl $0x24, %eax
ja 0x7afb
movslq (%r14,%rax,4), %rax
addq %r14, %rax
leaq 0x3f36(%rip), %rdi      # 0xb99d
jmpq *%rax
leaq 0x3f47(%rip), %rdi      # 0xb9b7
jmp 0x7b83
leaq 0x3f43(%rip), %rdi      # 0xb9bf
jmp 0x7b83
movsd 0x383f(%rip), %xmm0     # 0xb2c8
subsd 0xc447(%rip), %xmm0     # 0x13ed8
mulsd 0x386f(%rip), %xmm0     # 0xb308
leaq -0x90(%rbp), %rbx
movq %rbx, %rdi
pushq $0x64
popq %rsi
leaq 0x3f1a(%rip), %rdx      # 0xb9c7
jmp 0x7b79
leaq 0x3efa(%rip), %rdi      # 0xb9b3
jmp 0x7b83
movsd 0x3802(%rip), %xmm0     # 0xb2c8
subsd 0xc40a(%rip), %xmm0     # 0x13ed8
mulsd 0x3832(%rip), %xmm0     # 0xb308
leaq -0x90(%rbp), %rbx
movq %rbx, %rdi
pushq $0x64
popq %rsi
leaq 0x3e9c(%rip), %rdx      # 0xb986
jmp 0x7b79
leaq 0x3eaf(%rip), %rdi      # 0xb9a5
jmp 0x7b83
leaq 0x3d9b(%rip), %rdi      # 0xb89d
jmp 0x7b83
movsd 0x37bc(%rip), %xmm0     # 0xb2c8
subsd 0xc3c4(%rip), %xmm0     # 0x13ed8
mulsd 0x37ec(%rip), %xmm0     # 0xb308
leaq -0x90(%rbp), %rbx
movq %rbx, %rdi
pushq $0x64
popq %rsi
leaq 0x3e49(%rip), %rdx      # 0xb979
jmp 0x7b79
leaq 0x40a0(%rip), %rdi      # 0xbbd9
jmp 0x7b83
leaq 0x3e6b(%rip), %rdi      # 0xb9ad
jmp 0x7b83
leaq 0x3cd6(%rip), %rdi      # 0xb821
jmp 0x7b83
movsd 0x3773(%rip), %xmm0     # 0xb2c8
subsd 0xc37b(%rip), %xmm0     # 0x13ed8
mulsd 0x37a3(%rip), %xmm0     # 0xb308
leaq -0x90(%rbp), %rbx
movq %rbx, %rdi
pushq $0x64
popq %rsi
leaq 0x3e1a(%rip), %rdx      # 0xb993
movb $0x1, %al
callq 0x20e0
movq %rbx, %rdi
callq 0x2210
incq %r13
movl 0xc68f(%rip), %ebx      # 0x14220
addl %r13d, %ebx
addq $0x4, %r12
jmp 0x7a2b
leaq 0x3ceb(%rip), %rdi      # 0xb88f
jmp 0x7b83
movl $0x1, 0xdc30(%rip)      # 0x157e0
xorl %ebx, %ebx
xorl %edi, %edi
callq 0x7c56
movl 0xcf31(%rip), %edx      # 0x14af0
movslq 0xc65a(%rip), %rax      # 0x14220
testl %edx, %edx
movl $0x0, %ecx
cmovgl %edx, %ecx
leaq 0xdc19(%rip), %rsi      # 0x157f0
cmpq %rbx, %rcx
je 0x7be8
cmpq %rax, %rbx
setle (%rbx,%rsi)
incq %rbx
jmp 0x7bd7
movq 0xdbe9(%rip), %rdi      # 0x157d8
movl 0xdbdb(%rip), %esi      # 0x157d0
leaq 0xdbf4(%rip), %rcx      # 0x157f0
callq 0x4491
xorl %ebx, %ebx
cmpl 0xdbc7(%rip), %ebx      # 0x157d0
jge 0x7c3c
xorl %r14d, %r14d
movslq 0xcedb(%rip), %rax      # 0x14af0
cmpq %rax, %r14
jge 0x7c38
imull %ebx, %eax
cltq
shlq $0x3, %rax
addq 0xdbae(%rip), %rax      # 0x157d8
movq (%rax,%r14,8), %rdi
callq 0x2040
incq %r14
jmp 0x7c0e
incl %ebx
jmp 0x7c03
movq 0xdb95(%rip), %rdi      # 0x157d8
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2040