// File: /workspace/github_c_makefile_star2_O2/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 0xb857(%rip), %rax      # 0x13ec8
movl 0x14(%rax), %edx
xorl %ecx, %ecx
cmpl $0x0, 0xd38b(%rip)      # 0x15a08
movl %edx, 0xd14d(%rip)      # 0x157d0
sete %cl
movl 0xd374(%rip), %edx      # 0x15a00
addq $0x20, %rax
xorl %esi, %esi
testl %edx, %edx
cmovlel %esi, %edx
movl %ecx, 0xc453(%rip)      # 0x14af0
shlq $0x2, %rdx
leaq 0xc078(%rip), %rdi      # 0x14720
pushq $0x1
popq %r8
cmpq %rsi, %rdx
je 0x86da
movslq (%rsi,%rdi), %r9
imulq $0x28, %r9, %r9
cmpq $0x0, 0x10(%rax,%r9)
movl %r8d, %r10d
je 0x86cb
addq %rax, %r9
movl 0xc(%r9), %r10d
addl %r10d, %ecx
movl %ecx, 0xc41c(%rip)      # 0x14af0
addq $0x4, %rsi
jmp 0x86ac
movq 0xd4bf(%rip), %rdi      # 0x15ba0
callq 0x2040
movq 0xc3f3(%rip), %rdi      # 0x14ae0
callq 0x2040
movq 0xc3ef(%rip), %rdi      # 0x14ae8
callq 0x2040
movq 0xc3bb(%rip), %rdi      # 0x14ac0
callq 0x2040
movq 0xd497(%rip), %rdi      # 0x15ba8
callq 0x2040
movq 0xd493(%rip), %rdi      # 0x15bb0
callq 0x2040
movq 0xd48f(%rip), %rdi      # 0x15bb8
callq 0x2040
movq 0xc393(%rip), %rdi      # 0x14ac8
callq 0x2040
movq 0xc38f(%rip), %rdi      # 0x14ad0
callq 0x2040
movq 0xc38b(%rip), %rdi      # 0x14ad8
callq 0x2040
movl 0xc398(%rip), %edi      # 0x14af0
shll $0x2, %edi
callq 0x2a9b
movq %rax, 0xd439(%rip)      # 0x15ba0
movl 0xd063(%rip), %edi      # 0x157d0
shll $0x3, %edi
callq 0x2a9b
movq %rax, 0xc364(%rip)      # 0x14ae0
movl 0xd04e(%rip), %edi      # 0x157d0
shll $0x3, %edi
callq 0x2a9b
movq %rax, 0xc357(%rip)      # 0x14ae8
movl 0xc359(%rip), %edi      # 0x14af0
shll $0x3, %edi
callq 0x2a9b
movq %rax, 0xc31a(%rip)      # 0x14ac0
movl 0xc344(%rip), %edi      # 0x14af0
shll $0x3, %edi
callq 0x2a9b
movq %rax, 0xd3ed(%rip)      # 0x15ba8
movl 0xc32f(%rip), %edi      # 0x14af0
shll $0x3, %edi
callq 0x2a9b
movq %rax, 0xd3e0(%rip)      # 0x15bb0
movl 0xc31a(%rip), %edi      # 0x14af0
shll $0x3, %edi
callq 0x2a9b
movq %rax, 0xd3d3(%rip)      # 0x15bb8
movl 0xc305(%rip), %edi      # 0x14af0
imull %edi, %edi
shll $0x3, %edi
callq 0x2a9b
movq %rax, 0xc2cb(%rip)      # 0x14ac8
movl 0xc2ed(%rip), %edi      # 0x14af0
imull %edi, %edi
shll $0x3, %edi
callq 0x2a9b
movq %rax, 0xc2bb(%rip)      # 0x14ad0
movl 0xcfb5(%rip), %edi      # 0x157d0
imull 0xc2ce(%rip), %edi      # 0x14af0
shll $0x3, %edi
callq 0x2a9b
movq %rax, 0xc2a7(%rip)      # 0x14ad8
callq 0x931d
movl 0xc2b4(%rip), %edx      # 0x14af0
movl %edx, 0xc206(%rip)      # 0x14a48
xorl %eax, %eax
movq 0xd355(%rip), %rcx      # 0x15ba0
movslq %edx, %rdx
cmpq %rdx, %rax
jge 0x8862
andl $0x0, (%rcx,%rax,4)
incq %rax
movl 0xc290(%rip), %edx      # 0x14af0
jmp 0x884b
callq 0x94b2
callq 0x957a
cmpl $-0x1, %eax
jne 0x88fd
andl $0x0, 0xc1cc(%rip)      # 0x14a48
movq 0xd31d(%rip), %rcx      # 0x15ba0
xorl %edx, %edx
movslq 0xc264(%rip), %rax      # 0x14af0
cmpq %rax, %rdx
jge 0x889d
movl $0x1, (%rcx,%rdx,4)
incq %rdx
jmp 0x8885
xorl %ebx, %ebx
cltq
cmpq %rax, %rbx
jge 0x88e5
incl 0xc19c(%rip)            # 0x14a48
movq 0xd2ed(%rip), %rax      # 0x15ba0
andl $0x0, (%rax,%rbx,4)
callq 0x94b2
callq 0x957a
cmpl $-0x1, %eax
jne 0x88da
decl 0xc17c(%rip)            # 0x14a48
movq 0xd2cd(%rip), %rax      # 0x15ba0
movl $0x1, (%rax,%rbx,4)
incq %rbx
movl 0xc20d(%rip), %eax      # 0x14af0
jmp 0x889f
movq 0xd2b4(%rip), %rcx      # 0x15ba0
cmpl $0x0, -0x4(%rcx,%rax,4)
je 0x88fd
callq 0x94b2
callq 0x957a
movl 0xc145(%rip), %ecx      # 0x14a48
movl 0xcec6(%rip), %r8d      # 0x157d0
testl %ecx, %ecx
jle 0x8937
cmpl %r8d, %ecx
jge 0x8937
callq 0x99a8
callq 0x9a9f
callq 0x9b36
callq 0x9d14
callq 0x9d7f
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x9dbc
leaq 0x6f72(%rip), %rbx      # 0xf8b0
leaq 0x30cf(%rip), %rdx      # 0xba14
movl $0x7d0, %esi            # imm = 0x7D0
movq %rbx, %rdi
xorl %eax, %eax
callq 0x20e0
movq %rbx, %rdi
callq 0x267a