// File: /workspace/github_c_makefile_star2_O1/georgeweigt[P]sassafras/sassafras.c
// Function: proc_reg_regress
void
proc_reg_regress(void)
{
	int i, x;

	nrow = dataset->nobs;

	// determine the number of design matrix columns

	if (noint)
		ncol = 0;
	else
		ncol = 1;

	for (i = 0; i < num_x; i++) {
		x = xtab[i];
		if (dataset->spec[x].ltab == NULL)
			ncol++;
		else
			ncol += dataset->spec[x].num_levels;
	}

	xfree(Z);
	xfree(Y);
	xfree(Yhat);
	xfree(B);
	xfree(SE);
	xfree(TVAL);
	xfree(PVAL);
	xfree(GG);
	xfree(TT);
	xfree(XX);

	Z = xmalloc(ncol * sizeof (int));
	Y = xmalloc(nrow * sizeof (double));
	Yhat = xmalloc(nrow * sizeof (double));
	B = xmalloc(ncol * sizeof (double));
	SE = xmalloc(ncol * sizeof (double));
	TVAL = xmalloc(ncol * sizeof (double));
	PVAL = xmalloc(ncol * sizeof (double));
	GG = xmalloc(ncol * ncol * sizeof (double));
	TT = xmalloc(ncol * ncol * sizeof (double));
	XX = xmalloc(nrow * ncol * sizeof (double));

	proc_reg_compute_X();

	npar = ncol;

	for (i = 0; i < ncol; i++)
		Z[i] = 0;

	proc_reg_compute_T();

	// if singular then put in columns one by one

	if (proc_reg_compute_G() == -1) {
		npar = 0;
		for (i = 0; i < ncol; i++)
			Z[i] = 1;
		for (i = 0; i < ncol; i++) {
			npar++;
			Z[i] = 0;
			proc_reg_compute_T();
			if (proc_reg_compute_G() == -1) {
				npar--;
				Z[i] = 1;
			}
		}

		// did last column get zapped?

		if (Z[ncol - 1]) {
			proc_reg_compute_T();
			proc_reg_compute_G();
		}
	}

	// sanity check

	if (npar < 1 || npar >= nrow) {
		snprintf(errbuf, ERRBUFLEN, "Regression model kaput, p = %d, n = %d, must have 0 < p < n", npar, nrow);
		stop(errbuf);
	}

	proc_reg_compute_B();

	proc_reg_compute_Yhat();

	proc_reg_compute_mse();

	proc_reg_compute_SE();

	proc_reg_compute_TVAL();

	proc_reg_compute_PVAL();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq 0xb123(%rip), %rax      # 0x13ec8
movl 0x14(%rax), %ecx
movl %ecx, 0xca22(%rip)      # 0x157d0
xorl %ecx, %ecx
cmpl $0x0, 0xcc51(%rip)      # 0x15a08
sete %cl
movl %ecx, 0xbd30(%rip)      # 0x14af0
movslq 0xcc39(%rip), %rcx      # 0x15a00
testq %rcx, %rcx
jle 0x8e15
movl 0xbd1e(%rip), %edx      # 0x14af0
addq $0x20, %rax
shlq $0x2, %rcx
xorl %esi, %esi
leaq 0xb93d(%rip), %rdi      # 0x14720
movslq (%rsi,%rdi), %r8
leaq (%r8,%r8,4), %r8
cmpq $0x0, 0x10(%rax,%r8,8)
je 0x8dfd
leaq (%rax,%r8,8), %r8
movl 0xc(%r8), %r8d
jmp 0x8e03
movl $0x1, %r8d
addl %r8d, %edx
movl %edx, 0xbce4(%rip)      # 0x14af0
addq $0x4, %rsi
cmpq %rsi, %rcx
jne 0x8de3
movq 0xcd84(%rip), %rdi      # 0x15ba0
testq %rdi, %rdi
je 0x8e26
callq 0x2040
movq 0xbcb3(%rip), %rdi      # 0x14ae0
testq %rdi, %rdi
je 0x8e37
callq 0x2040
movq 0xbcaa(%rip), %rdi      # 0x14ae8
testq %rdi, %rdi
je 0x8e48
callq 0x2040
movq 0xbc71(%rip), %rdi      # 0x14ac0
testq %rdi, %rdi
je 0x8e59
callq 0x2040
movq 0xcd48(%rip), %rdi      # 0x15ba8
testq %rdi, %rdi
je 0x8e6a
callq 0x2040
movq 0xcd3f(%rip), %rdi      # 0x15bb0
testq %rdi, %rdi
je 0x8e7b
callq 0x2040
movq 0xcd36(%rip), %rdi      # 0x15bb8
testq %rdi, %rdi
je 0x8e8c
callq 0x2040
movq 0xbc35(%rip), %rdi      # 0x14ac8
testq %rdi, %rdi
je 0x8e9d
callq 0x2040
movq 0xbc2c(%rip), %rdi      # 0x14ad0
testq %rdi, %rdi
je 0x8eae
callq 0x2040
movq 0xbc23(%rip), %rdi      # 0x14ad8
testq %rdi, %rdi
je 0x8ebf
callq 0x2040
movl 0xbc2b(%rip), %edi      # 0x14af0
shll $0x2, %edi
callq 0x2bda
movq %rax, 0xcccc(%rip)      # 0x15ba0
movl 0xc8f6(%rip), %edi      # 0x157d0
shll $0x3, %edi
callq 0x2bda
movq %rax, 0xbbf7(%rip)      # 0x14ae0
movl 0xc8e1(%rip), %edi      # 0x157d0
shll $0x3, %edi
callq 0x2bda
movq %rax, 0xbbea(%rip)      # 0x14ae8
movl 0xbbec(%rip), %edi      # 0x14af0
shll $0x3, %edi
callq 0x2bda
movq %rax, 0xbbad(%rip)      # 0x14ac0
movl 0xbbd7(%rip), %edi      # 0x14af0
shll $0x3, %edi
callq 0x2bda
movq %rax, 0xcc80(%rip)      # 0x15ba8
movl 0xbbc2(%rip), %edi      # 0x14af0
shll $0x3, %edi
callq 0x2bda
movq %rax, 0xcc73(%rip)      # 0x15bb0
movl 0xbbad(%rip), %edi      # 0x14af0
shll $0x3, %edi
callq 0x2bda
movq %rax, 0xcc66(%rip)      # 0x15bb8
movl 0xbb98(%rip), %edi      # 0x14af0
imull %edi, %edi
shll $0x3, %edi
callq 0x2bda
movq %rax, 0xbb5e(%rip)      # 0x14ac8
movl 0xbb80(%rip), %edi      # 0x14af0
imull %edi, %edi
shll $0x3, %edi
callq 0x2bda
movq %rax, 0xbb4e(%rip)      # 0x14ad0
movl 0xc848(%rip), %edi      # 0x157d0
imull 0xbb61(%rip), %edi      # 0x14af0
shll $0x3, %edi
callq 0x2bda
movq %rax, 0xbb3a(%rip)      # 0x14ad8
callq 0x9b19
movl 0xbb47(%rip), %eax      # 0x14af0
movl %eax, 0xba99(%rip)      # 0x14a48
testl %eax, %eax
jle 0x8fd2
movq 0xcbe6(%rip), %rax      # 0x15ba0
xorl %ecx, %ecx
movl $0x0, (%rax,%rcx,4)
incq %rcx
movslq 0xbb23(%rip), %rdx      # 0x14af0
cmpq %rdx, %rcx
jl 0x8fbc
callq 0x9cb0
callq 0x9d7a
cmpl $-0x1, %eax
jne 0x9083
movl $0x0, 0xba59(%rip)      # 0x14a48
cmpl $0x0, 0xbafa(%rip)      # 0x14af0
jle 0x9017
movq 0xcba1(%rip), %rax      # 0x15ba0
xorl %ecx, %ecx
movl $0x1, (%rax,%rcx,4)
incq %rcx
movslq 0xbade(%rip), %rdx      # 0x14af0
cmpq %rdx, %rcx
jl 0x9001
movl 0xbad3(%rip), %eax      # 0x14af0
testl %eax, %eax
jle 0x9069
xorl %ebx, %ebx
incl 0xba1f(%rip)            # 0x14a48
movq 0xcb70(%rip), %rax      # 0x15ba0
movl $0x0, (%rax,%rbx,4)
callq 0x9cb0
callq 0x9d7a
cmpl $-0x1, %eax
jne 0x905a
decl 0xb9fc(%rip)            # 0x14a48
movq 0xcb4d(%rip), %rax      # 0x15ba0
movl $0x1, (%rax,%rbx,4)
incq %rbx
movslq 0xba8c(%rip), %rax      # 0x14af0
cmpq %rax, %rbx
jl 0x9023
movq 0xcb30(%rip), %rcx      # 0x15ba0
cltq
cmpl $0x0, -0x4(%rcx,%rax,4)
je 0x9083
callq 0x9cb0
callq 0x9d7a
movl 0xb9bf(%rip), %ecx      # 0x14a48
movl 0xc740(%rip), %r8d      # 0x157d0
testl %ecx, %ecx
jle 0x90f2
cmpl %r8d, %ecx
jge 0x90f2
callq 0xa11a
callq 0xa200
callq 0xa29b
callq 0xa4a5
movslq 0xb994(%rip), %rax      # 0x14a48
testq %rax, %rax
jle 0x90e7
movq 0xba00(%rip), %rcx      # 0x14ac0
movq 0xcae1(%rip), %rdx      # 0x15ba8
movq 0xcae2(%rip), %rsi      # 0x15bb0
xorl %edi, %edi
movsd (%rcx,%rdi,8), %xmm0
divsd (%rdx,%rdi,8), %xmm0
movsd %xmm0, (%rsi,%rdi,8)
incq %rdi
cmpq %rdi, %rax
jne 0x90d0
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0xa557
leaq 0x67b7(%rip), %rbx      # 0xf8b0
leaq 0x2944(%rip), %rdx      # 0xba44
movl $0x7d0, %esi            # imm = 0x7D0
movq %rbx, %rdi
xorl %eax, %eax
callq 0x20e0
callq 0xa74a
movq %rbx, %rdi
callq 0x4081
leaq 0xcabd(%rip), %rdi      # 0x15be0
movl $0x1, %esi
callq 0x21b0