// File: /workspace/github_c_makefile_star2_O3/georgeweigt[P]sassafras/sassafras.c
// Function: proc_anova_compute_G
int
proc_anova_compute_G(void)
{
	int d, i, j, k;
	double m, max, min, t;

	min = 0;
	max = 0;

	// G = I

	for (i = 0; i < npar; i++)
		for (j = 0; j < npar; j++)
			if (i == j)
				G(i, j) = 1;
			else
				G(i, j) = 0;

	// T = X'X

	for (i = 0; i < npar; i++)
		for (j = 0; j < npar; j++) {
			t = 0;
			for (k = 0; k < nobs; k++)
				t += X(k, i) * X(k, j);
			T(i, j) = t;
		}

	// G = inv T

	for (d = 0; d < npar; d++) {

		// find the best pivot row

		k = d;
		for (i = d + 1; i < npar; i++)
			if (fabs(T(i, d)) > fabs(T(k, d)))
				k = i;

		// exchange rows if necessary

		if (k != d) {
			for (j = d; j < npar; j++) { // skip zeroes, start at d
				t = T(d, j);
				T(d, j) = T(k, j);
				T(k, j) = t;
			}
			for (j = 0; j < npar; j++) {
				t = G(d, j);
				G(d, j) = G(k, j);
				G(k, j) = t;
			}
		}

		// multiply the pivot row by 1 / pivot

		m = T(d, d);

		if (m == 0)
			return -1;

		if (fabs(m) > max)
			max = fabs(m);

		m = 1 / m;

		if (fabs(m) > min)
			min = fabs(m);

		for (j = d; j < npar; j++) // skip zeroes, start at d
			T(d, j) *= m;
		for (j = 0; j < npar; j++)
			G(d, j) *= m;

		// clear out column below d

		for (i = d + 1; i < npar; i++) {
			m = -T(i, d);
			for (j = d; j < npar; j++) // skip zeroes, start at d
				T(i, j) += m * T(d, j);
			for (j = 0; j < npar; j++)
				G(i, j) += m * G(d, j);
		}
	}

	// clear out columns above diagonal

	for (d = npar - 1; d > 0; d--)
		for (i = 0; i < d; i++) {
			m = -T(i, d);
			for (j = 0; j < npar; j++)
				G(i, j) += m * G(d, j);
		}

	// check ratio of biggest divisor to smallest divisor

	// domain is [1, inf)

	// printf("cond = %g\n", max * min);

	if (max * min < 1e10)
		return 0;
	else
		return -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movslq 0xd58f(%rip), %rax      # 0x14a58
xorpd %xmm1, %xmm1
testq %rax, %rax
jle 0x78c4
movslq 0xd623(%rip), %rcx      # 0x14b00
leaq (,%rcx,8), %rdx
xorl %esi, %esi
movabsq $0x3ff0000000000000, %rdi # imm = 0x3FF0000000000000
xorl %r8d, %r8d
movq 0xd5dd(%rip), %r9       # 0x14ad8
movq %r8, %r10
imulq %rcx, %r10
leaq (%r9,%r10,8), %r10
addq %rsi, %r9
xorl %r11d, %r11d
cmpq %r11, %r8
jne 0x7517
movq %rdi, (%r10,%r8,8)
jmp 0x751f
movq $0x0, (%r9,%r11,8)
incq %r11
cmpq %r11, %rax
jne 0x750c
incq %r8
addq %rdx, %rsi
cmpq %rax, %r8
jne 0x74f4
xorpd %xmm5, %xmm5
testl %eax, %eax
jle 0x78c8
movl 0xd510(%rip), %ecx      # 0x14a54
movslq 0xd5b5(%rip), %rdx      # 0x14b00
movq 0xd58e(%rip), %rsi      # 0x14ae0
leaq (,%rdx,8), %rdi
xorl %r8d, %r8d
xorl %r9d, %r9d
movq 0xd581(%rip), %r10      # 0x14ae8
movq %r9, %r11
imulq %rdx, %r11
leaq (%rsi,%r11,8), %r11
xorl %ebx, %ebx
xorl %r14d, %r14d
xorpd %xmm0, %xmm0
testl %ecx, %ecx
jle 0x759d
movq %rcx, %r15
movq %r10, %r12
movsd (%r12,%r8), %xmm1
mulsd (%r12,%rbx), %xmm1
addsd %xmm1, %xmm0
addq %rdi, %r12
decq %r15
jne 0x7585
movsd %xmm0, (%r11,%r14,8)
incq %r14
addq $0x8, %rbx
cmpq %rax, %r14
jne 0x7577
incq %r9
addq $0x8, %r8
cmpq %rax, %r9
jne 0x7560
testl %eax, %eax
jle 0x78c0
movq 0xd516(%rip), %rcx      # 0x14ae0
movslq 0xd52f(%rip), %rdx      # 0x14b00
movq 0xd500(%rip), %r14      # 0x14ad8
leaq (,%rdx,8), %rdi
leaq (%rcx,%rdx,8), %r10
leaq 0x8(,%rdx,8), %rsi
movq %rsi, -0x60(%rbp)
xorpd %xmm2, %xmm2
movl $0x1, %r13d
movq $0x0, -0x38(%rbp)
movapd 0x3c96(%rip), %xmm3     # 0xb2a0
movsd 0x3cb6(%rip), %xmm4     # 0xb2c8
movapd 0x3c76(%rip), %xmm0     # 0xb290
movq %rdi, -0x30(%rbp)
movq %r14, -0x58(%rbp)
movq %rax, %r15
movq %rcx, %r12
movq %rcx, -0x40(%rbp)
xorpd %xmm1, %xmm1
xorpd %xmm5, %xmm5
xorl %esi, %esi
movapd %xmm5, %xmm7
movapd %xmm1, %xmm6
leaq 0x1(%rsi), %r8
movq %r8, -0x50(%rbp)
cmpq %rax, %r8
movq %r10, -0x48(%rbp)
jae 0x768f
leaq (%rcx,%rsi,8), %r9
movq %r13, %r11
movl %esi, %r8d
movsd (%r10), %xmm1
andpd %xmm3, %xmm1
movslq %r8d, %rbx
imulq %rdx, %rbx
movsd (%r9,%rbx,8), %xmm5
andpd %xmm3, %xmm5
ucomisd %xmm5, %xmm1
movl %r11d, %ebx
ja 0x767f
movl %r8d, %ebx
incq %r11
addq %rdi, %r10
movl %ebx, %r8d
cmpq %r11, %rax
jne 0x7659
jmp 0x7691
movl %esi, %ebx
movl %ebx, %r8d
cmpq %r8, %rsi
je 0x76ff
movl %edx, %r8d
imull %ebx, %r8d
movslq %r8d, %r8
movq -0x40(%rbp), %r9
leaq (%r9,%r8,8), %r8
xorl %r9d, %r9d
movsd (%r12,%r9,8), %xmm1
movsd (%r8,%r9,8), %xmm5
movsd %xmm5, (%r12,%r9,8)
movsd %xmm1, (%r8,%r9,8)
incq %r9
cmpq %r9, %r15
jne 0x76ae
imull %edx, %ebx
movslq %ebx, %r8
movq -0x58(%rbp), %r9
leaq (%r9,%r8,8), %r8
xorl %r9d, %r9d
movsd (%r14,%r9,8), %xmm1
movsd (%r8,%r9,8), %xmm5
movsd %xmm5, (%r14,%r9,8)
movsd %xmm1, (%r8,%r9,8)
incq %r9
cmpq %r9, %rax
jne 0x76df
movq %rsi, %r8
imulq %rdx, %r8
leaq (%rcx,%r8,8), %r8
movsd (%r8,%rsi,8), %xmm5
ucomisd %xmm2, %xmm5
jne 0x771c
jnp 0x78ea
movapd %xmm4, %xmm8
divsd %xmm5, %xmm8
andpd %xmm3, %xmm5
maxsd %xmm7, %xmm5
movapd %xmm8, %xmm1
andpd %xmm3, %xmm1
maxsd %xmm6, %xmm1
xorl %r8d, %r8d
movsd (%r12,%r8,8), %xmm6
mulsd %xmm8, %xmm6
movsd %xmm6, (%r12,%r8,8)
incq %r8
cmpq %r8, %r15
jne 0x773e
xorl %r8d, %r8d
movsd (%r14,%r8,8), %xmm6
mulsd %xmm8, %xmm6
movsd %xmm6, (%r14,%r8,8)
incq %r8
cmpq %r8, %rax
jne 0x775a
cmpq %rax, -0x50(%rbp)
jae 0x77f5
movq 0xd358(%rip), %r9       # 0x14ad8
movq -0x30(%rbp), %r8
leaq (%r9,%r8), %r11
addq -0x38(%rbp), %r9
movq -0x48(%rbp), %r8
movq %r13, %r10
movq %r10, %rbx
imulq %rdx, %rbx
leaq (%rcx,%rbx,8), %rbx
movsd (%rbx,%rsi,8), %xmm6
xorpd %xmm0, %xmm6
xorl %ebx, %ebx
movsd (%r12,%rbx,8), %xmm7
mulsd %xmm6, %xmm7
addsd (%r8,%rbx,8), %xmm7
movsd %xmm7, (%r8,%rbx,8)
incq %rbx
cmpq %rbx, %r15
jne 0x77a9
xorl %ebx, %ebx
movsd (%r9,%rbx,8), %xmm7
mulsd %xmm6, %xmm7
addsd (%r11,%rbx,8), %xmm7
movsd %xmm7, (%r11,%rbx,8)
incq %rbx
cmpq %rbx, %rax
jne 0x77c9
incq %r10
addq %rdi, %r8
addq %rdi, %r11
cmpq %rax, %r10
jne 0x7793
incq %r13
movq -0x48(%rbp), %r10
movq -0x60(%rbp), %rsi
addq %rsi, %r10
addq $0x8, -0x40(%rbp)
addq %rsi, %r12
decq %r15
addq %rdi, %r14
addq %rdi, -0x30(%rbp)
addq %rdi, -0x38(%rbp)
movq -0x50(%rbp), %rsi
cmpq %rax, %rsi
jne 0x7636
cmpl $0x1, %eax
je 0x78c8
movq 0xd2aa(%rip), %rcx      # 0x14ae0
movslq 0xd2c3(%rip), %rdx      # 0x14b00
leal -0x1(%rax), %esi
movl %eax, %eax
leaq (,%rdx,8), %rdi
leaq -0x1(%rax), %r8
imulq %rdx, %r8
shlq $0x3, %r8
movq %rax, %r9
movq %r9, %r10
decq %r9
leaq (%rcx,%r10,8), %r11
addq $-0x8, %r11
movq 0xd26a(%rip), %rbx      # 0x14ad8
leaq (%rbx,%r8), %r14
xorl %r15d, %r15d
movq %r15, %r12
imulq %rdx, %r12
movsd (%r11,%r12,8), %xmm2
xorpd %xmm0, %xmm2
xorl %r12d, %r12d
movsd (%r14,%r12,8), %xmm3
mulsd %xmm2, %xmm3
addsd (%rbx,%r12,8), %xmm3
movsd %xmm3, (%rbx,%r12,8)
incq %r12
cmpq %r12, %rax
jne 0x7889
incq %r15
addq %rdi, %rbx
cmpq %rsi, %r15
jne 0x7875
decq %rsi
subq %rdi, %r8
cmpq $0x3, %r10
jge 0x7859
jmp 0x78c8
xorpd %xmm1, %xmm1
xorpd %xmm5, %xmm5
mulsd %xmm5, %xmm1
movsd 0x3a4c(%rip), %xmm0     # 0xb320
xorl %eax, %eax
ucomisd %xmm1, %xmm0
setbe %al
negl %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x78df