// File: /workspace/github_c_makefile_star2_O1/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 0xd59f(%rip), %rax      # 0x14a48
testq %rax, %rax
jle 0x74f8
movslq 0xd63b(%rip), %rcx      # 0x14af0
shlq $0x3, %rcx
xorl %edx, %edx
movsd 0x3e35(%rip), %xmm0     # 0xb2f8
xorl %esi, %esi
movq 0xd5fc(%rip), %rdi      # 0x14ac8
addq %rdx, %rdi
xorl %r8d, %r8d
movapd %xmm0, %xmm1
cmpq %r8, %rsi
je 0x74df
xorpd %xmm1, %xmm1
movsd %xmm1, (%rdi,%r8,8)
incq %r8
cmpq %r8, %rax
jne 0x74d2
incq %rsi
addq %rcx, %rdx
cmpq %rax, %rsi
jne 0x74c5
testl %eax, %eax
jle 0x7579
movl 0xd542(%rip), %ecx      # 0x14a44
movslq 0xd5e7(%rip), %rdx      # 0x14af0
movq 0xd5c0(%rip), %rsi      # 0x14ad0
leaq (,%rdx,8), %rdi
xorl %r8d, %r8d
xorl %r9d, %r9d
movq 0xd5b3(%rip), %r10      # 0x14ad8
movq %r9, %r11
imulq %rdx, %r11
leaq (%rsi,%r11,8), %r11
xorl %ebx, %ebx
xorl %r14d, %r14d
xorpd %xmm0, %xmm0
testl %ecx, %ecx
jle 0x755b
movq %rcx, %r15
movq %r10, %r12
movsd (%r12,%r8), %xmm1
mulsd (%r12,%rbx), %xmm1
addsd %xmm1, %xmm0
addq %rdi, %r12
decq %r15
jne 0x7543
movsd %xmm0, (%r11,%r14,8)
incq %r14
addq $0x8, %rbx
cmpq %rax, %r14
jne 0x7535
incq %r9
addq $0x8, %r8
cmpq %rax, %r9
jne 0x751e
testl %eax, %eax
jle 0x77e5
movq 0xd548(%rip), %rcx      # 0x14ad0
movslq 0xd561(%rip), %rdx      # 0x14af0
movq 0xd532(%rip), %r14      # 0x14ac8
leaq (,%rdx,8), %rdi
leaq (%rcx,%rdx,8), %rsi
movq %rsi, -0x30(%rbp)
leaq 0x8(,%rdx,8), %rsi
movq %rsi, -0x60(%rbp)
xorpd %xmm0, %xmm0
movl $0x1, %r13d
movq $0x0, -0x40(%rbp)
movapd 0x3d04(%rip), %xmm1     # 0xb2d0
movsd 0x3d24(%rip), %xmm2     # 0xb2f8
movapd 0x3ce4(%rip), %xmm3     # 0xb2c0
movq %rdi, -0x38(%rbp)
movq %r14, -0x58(%rbp)
movq %rax, %r15
movq %rcx, %r12
movq %rcx, -0x48(%rbp)
xorpd %xmm5, %xmm5
xorpd %xmm4, %xmm4
xorl %esi, %esi
movapd %xmm4, %xmm7
movapd %xmm5, %xmm6
leaq 0x1(%rsi), %r8
movl %esi, %ebx
movq %r8, -0x50(%rbp)
cmpq %rax, %r8
jae 0x7651
leaq (%rcx,%rsi,8), %r9
movq -0x30(%rbp), %r10
movq %r13, %r11
movl %esi, %r8d
movsd (%r10), %xmm4
andpd %xmm1, %xmm4
movslq %r8d, %rbx
imulq %rdx, %rbx
movsd (%r9,%rbx,8), %xmm5
andpd %xmm1, %xmm5
ucomisd %xmm5, %xmm4
movl %r11d, %ebx
ja 0x7643
movl %r8d, %ebx
incq %r11
addq %rdi, %r10
movl %ebx, %r8d
cmpq %r11, %rax
jne 0x761d
movl %ebx, %r8d
cmpq %r8, %rsi
je 0x76bf
movl %edx, %r8d
imull %ebx, %r8d
movslq %r8d, %r8
movq -0x48(%rbp), %r9
leaq (%r9,%r8,8), %r8
xorl %r9d, %r9d
movsd (%r12,%r9,8), %xmm4
movsd (%r8,%r9,8), %xmm5
movsd %xmm5, (%r12,%r9,8)
movsd %xmm4, (%r8,%r9,8)
incq %r9
cmpq %r9, %r15
jne 0x766e
imull %edx, %ebx
movslq %ebx, %r8
movq -0x58(%rbp), %r9
leaq (%r9,%r8,8), %r8
xorl %r9d, %r9d
movsd (%r14,%r9,8), %xmm4
movsd (%r8,%r9,8), %xmm5
movsd %xmm5, (%r14,%r9,8)
movsd %xmm4, (%r8,%r9,8)
incq %r9
cmpq %r9, %rax
jne 0x769f
movq %rsi, %r8
imulq %rdx, %r8
leaq (%rcx,%r8,8), %r8
movsd (%r8,%rsi,8), %xmm4
ucomisd %xmm0, %xmm4
jne 0x76dc
jnp 0x78a6
movapd %xmm2, %xmm8
divsd %xmm4, %xmm8
andpd %xmm1, %xmm4
maxsd %xmm7, %xmm4
movapd %xmm8, %xmm5
andpd %xmm1, %xmm5
maxsd %xmm6, %xmm5
xorl %r8d, %r8d
movsd (%r12,%r8,8), %xmm6
mulsd %xmm8, %xmm6
movsd %xmm6, (%r12,%r8,8)
incq %r8
cmpq %r8, %r15
jne 0x76fe
xorl %r8d, %r8d
movsd (%r14,%r8,8), %xmm6
mulsd %xmm8, %xmm6
movsd %xmm6, (%r14,%r8,8)
incq %r8
cmpq %r8, %rax
jne 0x771a
cmpq %rax, -0x50(%rbp)
jae 0x77b5
movq 0xd388(%rip), %r9       # 0x14ac8
movq -0x38(%rbp), %r8
leaq (%r9,%r8), %r11
addq -0x40(%rbp), %r9
movq -0x30(%rbp), %r8
movq %r13, %r10
movq %r10, %rbx
imulq %rdx, %rbx
leaq (%rcx,%rbx,8), %rbx
movsd (%rbx,%rsi,8), %xmm6
xorpd %xmm3, %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 0x7769
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 0x7789
incq %r10
addq %rdi, %r8
addq %rdi, %r11
cmpq %rax, %r10
jne 0x7753
incq %r13
movq -0x60(%rbp), %rsi
addq %rsi, -0x30(%rbp)
addq $0x8, -0x48(%rbp)
addq %rsi, %r12
decq %r15
addq %rdi, %r14
addq %rdi, -0x38(%rbp)
addq %rdi, -0x40(%rbp)
movq -0x50(%rbp), %rsi
cmpq %rax, %rsi
jne 0x75f8
jmp 0x77ed
xorpd %xmm4, %xmm4
xorpd %xmm5, %xmm5
cmpl $0x2, %eax
jl 0x788d
movq 0xd2d3(%rip), %rcx      # 0x14ad0
movslq 0xd2ec(%rip), %rdx      # 0x14af0
leal -0x1(%rax), %esi
leaq (,%rdx,8), %rdi
movq %rax, %r8
decq %r8
imulq %rdx, %r8
shlq $0x3, %r8
movapd 0x3a9b(%rip), %xmm0     # 0xb2c0
movq %rax, %r9
movq %r9, %r10
decq %r9
leaq (%rcx,%r10,8), %r11
addq $-0x8, %r11
movq 0xd28b(%rip), %rbx      # 0x14ac8
leaq (%rbx,%r8), %r14
xorl %r15d, %r15d
movq %r15, %r12
imulq %rdx, %r12
movsd (%r11,%r12,8), %xmm1
xorpd %xmm0, %xmm1
xorl %r12d, %r12d
movsd (%r14,%r12,8), %xmm2
mulsd %xmm1, %xmm2
addsd (%rbx,%r12,8), %xmm2
movsd %xmm2, (%rbx,%r12,8)
incq %r12
cmpq %r12, %rax
jne 0x7858
incq %r15
addq %rdi, %rbx
cmpq %rsi, %r15
jne 0x7844
decq %rsi
subq %rdi, %r8
cmpq $0x3, %r10
jge 0x7828
mulsd %xmm5, %xmm4
movsd 0x3ab7(%rip), %xmm0     # 0xb350
xorl %eax, %eax
ucomisd %xmm4, %xmm0
setbe %al
negl %eax
jmp 0x78ab
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq