// File: /workspace/github_c_makefile_star2_O0/georgeweigt[P]sassafras/sassafras.c
// Function: h
void
h(int varnum)
{
	int i, j, k, w;
	double m, t1, t2, x;
	char buf[100];

	int n = 0;

	double mean = NAN;
	double variance = NAN;

	double min = NAN;
	double max = NAN;
	double sum = NAN;

	double stddev = NAN;
	double stderror = NAN;

	double range = NAN;

	for (i = 0; i < dataset->nobs; i++) {

		// filter

		for (j = 0; j < nclass; j++) {
			k = class[j];
			if (dataset->spec[k].v[i] != filtertab[j])
				break;
		}

		if (j < nclass)
			continue;

		// if categorical variable then only N makes sense

		if (dataset->spec[varnum].ltab) {
			if (dataset->spec[varnum].v[i])
				n++;
			continue;
		}

		x = dataset->spec[varnum].v[i];

		if (isnan(x))
			continue;

		n++;

		if (n == 1) {
			mean = x;
			variance = 0.0;
			min = x;
			max = x;
			sum = 0.0;
			stddev = 0.0;
			stderror = 0.0;
		}

		m = mean;

		mean += (x - m) / n;

		variance += (x - m) * (x - mean);

		if (x < min)
			min = x;

		if (x > max)
			max = x;

		sum += x;
	}

	range = max - min;

	if (n > 1) {
		variance /= (n - 1);
		stddev = sqrt(variance);
		stderror = stddev / sqrt(n);
	}

	t1 = qt(1 - alpha, n - 1.0);
	t2 = qt(1 - alpha / 2, n - 1.0);

	for (i = 0; i < nstats; i++) {
		w = maxdec;
		switch (stats[i]) {
		case KCLM1:
			x = mean - t2 * stderror;
			break;
		case KCLM2:
			x = mean + t2 * stderror;
			break;
		case KLCLM:
			x = mean - t1 * stderror;
			break;
		case KMAX:
			x = max;
			break;
		case KMEAN:
			x = mean;
			break;
		case KMIN:
			x = min;
			break;
		case KN:
			x = n;
			w = 0;
			break;
		case KRANGE:
			x = range;
			break;
		case KSUM:
			x = sum;
			break;
		case KSTD:
		case KSTDDEV:
			x = stddev;
			break;
		case KSTDERR:
		case KSTDMEAN:
			x = stderror;
			break;
		case KUCLM:
			x = mean + t1 * stderror;
			break;
		case KVAR:
			x = variance;
			break;
		default:
			x = NAN;
			break;
		}
		if (isnan(x))
			A(row, nclass + 1 + i) = strdup(".");
		else {
			snprintf(buf, sizeof buf, fmt[w], x);
			A(row, nclass + 1 + i) = strdup(buf);
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movl %edi, -0x4(%rbp)
movl $0x0, -0xa4(%rbp)
movsd 0x4748(%rip), %xmm0     # 0xf1d8
movsd %xmm0, -0xb0(%rbp)
movsd 0x4738(%rip), %xmm0     # 0xf1d8
movsd %xmm0, -0xb8(%rbp)
movsd 0x4728(%rip), %xmm0     # 0xf1d8
movsd %xmm0, -0xc0(%rbp)
movsd 0x4718(%rip), %xmm0     # 0xf1d8
movsd %xmm0, -0xc8(%rbp)
movsd 0x4708(%rip), %xmm0     # 0xf1d8
movsd %xmm0, -0xd0(%rbp)
movsd 0x46f8(%rip), %xmm0     # 0xf1d8
movsd %xmm0, -0xd8(%rbp)
movsd 0x46e8(%rip), %xmm0     # 0xf1d8
movsd %xmm0, -0xe0(%rbp)
movsd 0x46d8(%rip), %xmm0     # 0xf1d8
movsd %xmm0, -0xe8(%rbp)
movl $0x0, -0x8(%rbp)
movl -0x8(%rbp), %eax
movq 0xd39f(%rip), %rcx      # 0x17eb8
cmpl 0x14(%rcx), %eax
jge 0xad6d
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
cmpl 0xd6de(%rip), %eax      # 0x18210
jge 0xab91
movslq -0xc(%rbp), %rcx
leaq 0xd541(%rip), %rax      # 0x18080
movl (%rax,%rcx,4), %eax
movl %eax, -0x10(%rbp)
movq 0xd36c(%rip), %rax      # 0x17eb8
addq $0x20, %rax
movslq -0x10(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq 0x20(%rax), %rax
movslq -0x8(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movslq -0xc(%rbp), %rcx
leaq 0xeced(%rip), %rax      # 0x19860
cvtsi2sdl (%rax,%rcx,4), %xmm1
ucomisd %xmm1, %xmm0
jne 0xab82
jp 0xab82
jmp 0xab84
jmp 0xab91
jmp 0xab86
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0xab29
movl -0xc(%rbp), %eax
cmpl 0xd676(%rip), %eax      # 0x18210
jge 0xaba1
jmp 0xad5f
movq 0xd310(%rip), %rax      # 0x17eb8
addq $0x20, %rax
movslq -0x4(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
cmpq $0x0, 0x10(%rax)
je 0xac02
movq 0xd2f3(%rip), %rax      # 0x17eb8
addq $0x20, %rax
movslq -0x4(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq 0x20(%rax), %rax
movslq -0x8(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0xabee
jp 0xabee
jmp 0xabfd
movl -0xa4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa4(%rbp)
jmp 0xad5f
movq 0xd2af(%rip), %rax      # 0x17eb8
addq $0x20, %rax
movslq -0x4(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq 0x20(%rax), %rax
movslq -0x8(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x38(%rbp)
movsd -0x38(%rbp), %xmm0
ucomisd %xmm0, %xmm0
setp %al
testb $0x1, %al
jne 0xac3c
jmp 0xac41
jmp 0xad5f
movl -0xa4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa4(%rbp)
cmpl $0x1, -0xa4(%rbp)
jne 0xacac
movsd -0x38(%rbp), %xmm0
movsd %xmm0, -0xb0(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0xb8(%rbp)
movsd -0x38(%rbp), %xmm0
movsd %xmm0, -0xc0(%rbp)
movsd -0x38(%rbp), %xmm0
movsd %xmm0, -0xc8(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0xd0(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0xd8(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0xe0(%rbp)
movsd -0xb0(%rbp), %xmm0
movsd %xmm0, -0x20(%rbp)
movsd -0x38(%rbp), %xmm0
subsd -0x20(%rbp), %xmm0
cvtsi2sdl -0xa4(%rbp), %xmm1
divsd %xmm1, %xmm0
addsd -0xb0(%rbp), %xmm0
movsd %xmm0, -0xb0(%rbp)
movsd -0x38(%rbp), %xmm0
subsd -0x20(%rbp), %xmm0
movsd -0x38(%rbp), %xmm2
subsd -0xb0(%rbp), %xmm2
movsd -0xb8(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0xb8(%rbp)
movsd -0x38(%rbp), %xmm1
movsd -0xc0(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0xad2e
movsd -0x38(%rbp), %xmm0
movsd %xmm0, -0xc0(%rbp)
movsd -0x38(%rbp), %xmm0
ucomisd -0xc8(%rbp), %xmm0
jbe 0xad4a
movsd -0x38(%rbp), %xmm0
movsd %xmm0, -0xc8(%rbp)
movsd -0x38(%rbp), %xmm0
addsd -0xd0(%rbp), %xmm0
movsd %xmm0, -0xd0(%rbp)
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0xab0f
movsd -0xc8(%rbp), %xmm0
subsd -0xc0(%rbp), %xmm0
movsd %xmm0, -0xe8(%rbp)
cmpl $0x1, -0xa4(%rbp)
jle 0xadf8
movl -0xa4(%rbp), %eax
subl $0x1, %eax
cvtsi2sd %eax, %xmm1
movsd -0xb8(%rbp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, -0xb8(%rbp)
movsd -0xb8(%rbp), %xmm0
callq 0x21e0
movsd %xmm0, -0xd8(%rbp)
movsd -0xd8(%rbp), %xmm0
movsd %xmm0, -0xf0(%rbp)
cvtsi2sdl -0xa4(%rbp), %xmm0
callq 0x21e0
movaps %xmm0, %xmm1
movsd -0xf0(%rbp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, -0xe0(%rbp)
movsd 0x43e0(%rip), %xmm0     # 0xf1e0
subsd 0xd0c0(%rip), %xmm0     # 0x17ec8
cvtsi2sdl -0xa4(%rbp), %xmm1
movsd 0x43c8(%rip), %xmm2     # 0xf1e0
subsd %xmm2, %xmm1
callq 0x9da0
movsd %xmm0, -0x28(%rbp)
movsd 0xd09a(%rip), %xmm1     # 0x17ec8
movsd 0x43b2(%rip), %xmm0     # 0xf1e8
divsd %xmm0, %xmm1
movsd 0x439e(%rip), %xmm0     # 0xf1e0
subsd %xmm1, %xmm0
cvtsi2sdl -0xa4(%rbp), %xmm1
movsd 0x438a(%rip), %xmm2     # 0xf1e0
subsd %xmm2, %xmm1
callq 0x9da0
movsd %xmm0, -0x30(%rbp)
movl $0x0, -0x8(%rbp)
movl -0x8(%rbp), %eax
cmpl 0xe90c(%rip), %eax      # 0x19780
jge 0xb0f5
movl 0xd050(%rip), %eax      # 0x17ed0
movl %eax, -0x14(%rbp)
movslq -0x8(%rbp), %rcx
leaq 0xe902(%rip), %rax      # 0x19790
movl (%rax,%rcx,4), %eax
addl $0xfffffecd, %eax       # imm = 0xFFFFFECD
movl %eax, %ecx
movq %rcx, -0xf8(%rbp)
subl $0x24, %eax
ja 0xb01d
movq -0xf8(%rbp), %rax
leaq 0x421a(%rip), %rcx      # 0xf0d0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movsd -0xb0(%rbp), %xmm1
movsd -0x30(%rbp), %xmm0
movsd -0xe0(%rbp), %xmm2
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x38(%rbp)
jmp 0xb02a
movsd -0xb0(%rbp), %xmm1
movsd -0x30(%rbp), %xmm0
movsd -0xe0(%rbp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x38(%rbp)
jmp 0xb02a
movsd -0xb0(%rbp), %xmm1
movsd -0x28(%rbp), %xmm0
movsd -0xe0(%rbp), %xmm2
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x38(%rbp)
jmp 0xb02a
movsd -0xc8(%rbp), %xmm0
movsd %xmm0, -0x38(%rbp)
jmp 0xb02a
movsd -0xb0(%rbp), %xmm0
movsd %xmm0, -0x38(%rbp)
jmp 0xb02a
movsd -0xc0(%rbp), %xmm0
movsd %xmm0, -0x38(%rbp)
jmp 0xb02a
cvtsi2sdl -0xa4(%rbp), %xmm0
movsd %xmm0, -0x38(%rbp)
movl $0x0, -0x14(%rbp)
jmp 0xb02a
movsd -0xe8(%rbp), %xmm0
movsd %xmm0, -0x38(%rbp)
jmp 0xb02a
movsd -0xd0(%rbp), %xmm0
movsd %xmm0, -0x38(%rbp)
jmp 0xb02a
movsd -0xd8(%rbp), %xmm0
movsd %xmm0, -0x38(%rbp)
jmp 0xb02a
movsd -0xe0(%rbp), %xmm0
movsd %xmm0, -0x38(%rbp)
jmp 0xb02a
movsd -0xb0(%rbp), %xmm1
movsd -0x28(%rbp), %xmm0
movsd -0xe0(%rbp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x38(%rbp)
jmp 0xb02a
movsd -0xb8(%rbp), %xmm0
movsd %xmm0, -0x38(%rbp)
jmp 0xb02a
movsd 0x41b3(%rip), %xmm0     # 0xf1d8
movsd %xmm0, -0x38(%rbp)
movsd -0x38(%rbp), %xmm0
ucomisd %xmm0, %xmm0
setp %al
testb $0x1, %al
jne 0xb03c
jmp 0xb07e
leaq 0x4795(%rip), %rdi      # 0xf7d8
callq 0x21f0
movq %rax, %rdx
movq 0xe776(%rip), %rax      # 0x197c8
movl 0xe778(%rip), %ecx      # 0x197d0
imull 0xda81(%rip), %ecx      # 0x18ae0
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movl 0xd1a1(%rip), %ecx      # 0x18210
addl $0x1, %ecx
addl -0x8(%rbp), %ecx
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
jmp 0xb0e5
leaq -0xa0(%rbp), %rdi
movslq -0x14(%rbp), %rcx
leaq 0x8090(%rip), %rax      # 0x13120
movq (%rax,%rcx,8), %rdx
movsd -0x38(%rbp), %xmm0
movl $0x64, %esi
movb $0x1, %al
callq 0x20c0
leaq -0xa0(%rbp), %rdi
callq 0x21f0
movq %rax, %rdx
movq 0xe70d(%rip), %rax      # 0x197c8
movl 0xe70f(%rip), %ecx      # 0x197d0
imull 0xda18(%rip), %ecx      # 0x18ae0
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movl 0xd138(%rip), %ecx      # 0x18210
addl $0x1, %ecx
addl -0x8(%rbp), %ecx
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
jmp 0xb0e7
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0xae6b
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
nop