// File: /workspace/github_c_makefile_star2_O3/georgeweigt[P]sassafras/sassafras.c
// Function: proc_anova_add_interaction
void
proc_anova_add_interaction(int n)
{
	int i, j, k, len, m, x;
	char *name, *s;
	double d;

	len = n; // accommodate n - 1 asterisks and 1 end of line

	for (i = 0; i < n; i++) {
		x = xx[i];
		s = dataset->spec[x].name;
		len += strlen(s);
	}

	name = (char *) xmalloc(len);

	name[0] = 0;

	for (i = 0; i < n; i++) {
		if (i > 0)
			strcat(name, "*");
		x = xx[i];
		s = dataset->spec[x].name;
		strcat(name, s);
	}

	// is it already in the data set?

	for (m = 0; m < dataset->nvar; m++)
		if (strcmp(name, dataset->spec[m].name) == 0)
			break;

	if (m < dataset->nvar)
		free(name);
	else {
		if (dataset->nvar == MAXVAR)
			stop("Too many variable names");

		m = dataset->nvar++;

		dataset->spec[m].name = name;

		// number of levels

		k = 1;
		for (i = 0; i < n; i++) {
			x = xx[i];
			k *= dataset->spec[x].num_levels;
		}

		dataset->spec[m].ltab = (char **) xmalloc(k * sizeof (char *));
		dataset->spec[m].max_levels = k;
		dataset->spec[m].num_levels = k;
		dataset->spec[m].v = (double *) xmalloc(dataset->max * sizeof (double));

		proc_anova_create_interaction_level_names(n);

		// data values

		for (i = 0; i < dataset->nobs; i++) {
			d = 0;
			for (j = 0; j < n; j++) {
				x = xx[j];
				d = d * dataset->spec[x].num_levels + dataset->spec[x].v[i];
			}
			dataset->spec[m].v[i] = d;
		}
	}

	// is it already an explanatory variable?

	for (i = 0; i < nx; i++)
		if (xtab[i] == m)
			return;

	if (nx == MAXVAR)
		stop("Too many explanatory variables");

	xtab[nx++] = m;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edi, %r12d
movl %edi, %r15d
testl %edi, %edi
movl %edi, -0x30(%rbp)
jle 0x62bc
movq 0xdcc6(%rip), %rbx      # 0x13ed8
addq $0x20, %rbx
movl %r12d, %r14d
leaq (,%r15,4), %r12
xorl %r13d, %r13d
leaq 0xe375(%rip), %rax      # 0x145a0
movslq (%r13,%rax), %rax
leaq (%rax,%rax,4), %rax
movq (%rbx,%rax,8), %rdi
callq 0x20b0
addl %eax, %r14d
addq $0x4, %r13
cmpq %r13, %r12
jne 0x6224
movl %r14d, %edi
callq 0x2bd8
movq %rax, %r14
movb $0x0, (%rax)
movq 0xdc7a(%rip), %rcx      # 0x13ed8
movl -0x30(%rbp), %r12d
testl %r12d, %r12d
jle 0x62d1
movq %rcx, -0x38(%rbp)
leaq 0x20(%rcx), %rbx
leaq (,%r15,4), %r13
xorl %r12d, %r12d
testq %r12, %r12
je 0x628e
movq %r14, %rdi
callq 0x20b0
movw $0x2a, (%r14,%rax)
leaq 0xe30b(%rip), %rax      # 0x145a0
movslq (%r12,%rax), %rax
leaq (%rax,%rax,4), %rax
movq (%rbx,%rax,8), %rsi
movq %r14, %rdi
callq 0x21f0
addq $0x4, %r12
cmpq %r12, %r13
jne 0x627a
movl -0x30(%rbp), %r12d
movq -0x38(%rbp), %rcx
jmp 0x62d1
movl %r12d, %edi
callq 0x2bd8
movq %rax, %r14
movb $0x0, (%rax)
movq 0xdc07(%rip), %rcx      # 0x13ed8
movslq 0x10(%rcx), %r13
testq %r13, %r13
jle 0x631d
movq %r13, -0x40(%rbp)
movl %r13d, %r13d
movq %rcx, -0x38(%rbp)
leaq 0x20(%rcx), %rbx
xorl %r12d, %r12d
movq (%rbx), %rsi
movq %r14, %rdi
callq 0x2170
testl %eax, %eax
je 0x6378
incq %r12
addq $0x28, %rbx
cmpq %r12, %r13
jne 0x62ec
cmpl $0x64, %r13d
movl -0x30(%rbp), %r12d
movq -0x40(%rbp), %r13
movq -0x38(%rbp), %rcx
je 0x64a6
leal 0x1(%r13), %eax
movl %eax, 0x10(%rcx)
leaq (,%r13,4), %rax
addq %r13, %rax
movq %rax, -0x30(%rbp)
movq %r14, 0x20(%rcx,%rax,8)
testl %r12d, %r12d
jle 0x6388
movq 0xdb94(%rip), %rax      # 0x13ed8
addq $0x20, %rax
leaq (,%r15,4), %rcx
movl $0x1, %r14d
xorl %edx, %edx
leaq 0xe241(%rip), %rsi      # 0x145a0
movslq (%rdx,%rsi), %rdi
leaq (%rdi,%rdi,4), %rdi
imull 0xc(%rax,%rdi,8), %r14d
addq $0x4, %rdx
cmpq %rdx, %rcx
jne 0x635f
jmp 0x638e
movq %r14, %rdi
callq 0x2040
movl %r12d, %r13d
jmp 0x6459
movl $0x1, %r14d
leal (,%r14,8), %edi
callq 0x2bd8
movq 0xdb36(%rip), %rcx      # 0x13ed8
movq %r13, %rdx
shlq $0x3, %rdx
leaq (%rdx,%rdx,4), %rbx
movq %rax, 0x30(%rcx,%rbx)
movq 0xdb1f(%rip), %rax      # 0x13ed8
movl %r14d, 0x28(%rax,%rbx)
movl %r14d, 0x2c(%rax,%rbx)
movl 0x18(%rax), %edi
shll $0x3, %edi
callq 0x2bd8
movq 0xdb03(%rip), %rcx      # 0x13ed8
movq %rax, 0x40(%rcx,%rbx)
movl %r12d, %edi
callq 0x64e2
movq 0xdaef(%rip), %rax      # 0x13ed8
movslq 0x14(%rax), %rcx
testq %rcx, %rcx
jle 0x6459
movq -0x30(%rbp), %rdx
movq 0x40(%rax,%rdx,8), %rdx
addq $0x20, %rax
shlq $0x2, %r15
xorl %esi, %esi
leaq 0xe194(%rip), %rdi      # 0x145a0
testl %r12d, %r12d
jle 0x6448
xorpd %xmm1, %xmm1
xorl %r8d, %r8d
movslq (%r8,%rdi), %r9
leaq (%r9,%r9,4), %r9
xorps %xmm0, %xmm0
cvtsi2sdl 0xc(%rax,%r9,8), %xmm0
mulsd %xmm1, %xmm0
movq 0x20(%rax,%r9,8), %r9
addsd (%r9,%rsi,8), %xmm0
addq $0x4, %r8
movapd %xmm0, %xmm1
cmpq %r8, %r15
jne 0x6418
jmp 0x644c
xorpd %xmm0, %xmm0
movsd %xmm0, (%rdx,%rsi,8)
incq %rsi
cmpq %rcx, %rsi
jne 0x640c
movslq 0xdf98(%rip), %rax      # 0x143f8
leaq 0xe2c9(%rip), %rcx      # 0x14730
testq %rax, %rax
jle 0x648a
leaq (,%rax,4), %rdx
xorl %esi, %esi
cmpl %r13d, (%rsi,%rcx)
je 0x6497
addq $0x4, %rsi
cmpq %rsi, %rdx
jne 0x6476
cmpl $0x64, %eax
je 0x64b4
leal 0x1(%rax), %edx
movl %edx, 0xdf65(%rip)      # 0x143f8
movl %r13d, (%rcx,%rax,4)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0xa7e0
leaq 0x531f(%rip), %rdi      # 0xb7d1
jmp 0x64c0
callq 0xa7e0
leaq 0x5278(%rip), %rdi      # 0xb738
callq 0x4039
leaq 0xf724(%rip), %rdi      # 0x15bf0
movl $0x1, %esi
callq 0x21c0