// File: /workspace/github_c_makefile_star2_O2/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
movl 0xdbeb(%rip), %r8d      # 0x14a48
movslq %r8d, %r15
xorl %eax, %eax
testl %r15d, %r15d
movl $0x0, %edx
cmovgl %r15d, %edx
movslq 0xdc7b(%rip), %r13      # 0x14af0
leaq (,%r13,8), %rdi
movabsq $0x3ff0000000000000, %r9 # imm = 0x3FF0000000000000
xorl %r10d, %r10d
cmpq %rdx, %r10
je 0x6ec9
movq 0xdc32(%rip), %rcx      # 0x14ac8
movq %r10, %rsi
imulq %r13, %rsi
leaq (%rcx,%rsi,8), %rsi
addq %rax, %rcx
xorl %r11d, %r11d
cmpq %r11, %r8
je 0x6ec1
cmpq %r11, %r10
jne 0x6eb7
movq %r9, (%rsi,%r10,8)
jmp 0x6ebc
andq $0x0, (%rcx,%r11,8)
incq %r11
jmp 0x6ea7
incq %r10
addq %rdi, %rax
jmp 0x6e8a
movl 0xdb75(%rip), %eax      # 0x14a44
xorl %r10d, %r10d
testl %eax, %eax
cmovlel %r10d, %eax
xorl %r11d, %r11d
movq 0xdbee(%rip), %rsi      # 0x14ad0
cmpq %rdx, %r11
je 0x6f3c
movq %r11, %rcx
imulq %r13, %rcx
leaq (%rsi,%rcx,8), %r9
xorl %ebx, %ebx
xorl %r14d, %r14d
cmpq %r8, %r14
je 0x6f33
xorpd %xmm0, %xmm0
movq 0xdbd1(%rip), %rcx      # 0x14ad8
movq %rax, %rsi
subq $0x1, %rsi
jb 0x6f24
movsd (%rcx,%r10), %xmm1
mulsd (%rcx,%rbx), %xmm1
addsd %xmm1, %xmm0
addq %rdi, %rcx
jmp 0x6f0a
movsd %xmm0, (%r9,%r14,8)
incq %r14
addq $0x8, %rbx
jmp 0x6ef7
incq %r11
addq $0x8, %r10
jmp 0x6edb
movl %r8d, %eax
leaq 0x8(,%r13,8), %rcx
movq %rcx, -0x70(%rbp)
xorpd %xmm2, %xmm2
movl $0x1, %ecx
movapd 0x4344(%rip), %xmm3     # 0xb2a0
movsd 0x4364(%rip), %xmm4     # 0xb2c8
movapd 0x4324(%rip), %xmm0     # 0xb290
movq %rsi, %r12
movq $0x0, -0x30(%rbp)
movq $0x0, -0x60(%rbp)
movq %rax, -0xa0(%rbp)
movq %rax, -0x58(%rbp)
movq %rsi, %rax
movq $0x0, -0x38(%rbp)
xorl %r10d, %r10d
xorpd %xmm5, %xmm5
xorpd %xmm1, %xmm1
movq %rsi, %r11
xorl %esi, %esi
movq %r15, -0x68(%rbp)
movq %r13, -0x40(%rbp)
movq %r11, -0x78(%rbp)
cmpl %r10d, %r8d
movl %r10d, %ebx
cmovgl %r8d, %ebx
cmpl %r10d, %r8d
movl %r10d, %r9d
cmovgl %r8d, %r9d
cmpq %rdx, %r10
je 0x7254
movl %ecx, -0x4c(%rbp)
movslq %ecx, %rcx
movq %rdi, %r14
imulq %rcx, %r14
addq %rsi, %rbx
movq %r9, %r11
movq %rdi, %r9
imulq %rcx, %r9
movq %rax, -0x90(%rbp)
addq %r9, %rax
movq %rsi, -0x98(%rbp)
addq %rsi, %r11
movq %r11, -0x88(%rbp)
addq -0x38(%rbp), %r9
movq 0xdac2(%rip), %r13      # 0x14ad0
movq %r10, %rsi
leaq (,%r10,8), %r10
addq %r13, %r10
addq %r13, %r9
movq %rcx, %r11
movq %rsi, -0x48(%rbp)
movl %esi, %r15d
cmpq -0x68(%rbp), %r11
jge 0x7064
movsd (%r9), %xmm6
andpd %xmm3, %xmm6
movq -0x40(%rbp), %rsi
imull %r15d, %esi
movslq %esi, %rsi
movsd (%r10,%rsi,8), %xmm7
andpd %xmm3, %xmm7
ucomisd %xmm7, %xmm6
movl %r11d, %esi
ja 0x7059
movl %r15d, %esi
incq %r11
addq %rdi, %r9
movl %esi, %r15d
jmp 0x7029
movl %r15d, %esi
cmpq %rsi, -0x48(%rbp)
movq -0x78(%rbp), %r11
jne 0x71d6
movq -0x48(%rbp), %r10
movq %r10, %rsi
movq -0x40(%rbp), %r13
imulq %r13, %rsi
leaq (%r11,%rsi,8), %rsi
movsd (%rsi,%r10,8), %xmm6
ucomisd %xmm2, %xmm6
jne 0x709a
jnp 0x72eb
leaq 0x1(%r10), %rsi
movq %rsi, -0x80(%rbp)
movapd %xmm4, %xmm8
divsd %xmm6, %xmm8
andpd %xmm3, %xmm6
movapd %xmm8, %xmm7
andpd %xmm3, %xmm7
xorl %esi, %esi
movq -0x68(%rbp), %r15
movq -0x88(%rbp), %r9
cmpq %rsi, %r9
je 0x70e1
movsd (%r12,%rsi,8), %xmm9
mulsd %xmm8, %xmm9
movsd %xmm9, (%r12,%rsi,8)
incq %rsi
jmp 0x70c6
maxsd %xmm5, %xmm6
movq 0xd9dc(%rip), %rsi      # 0x14ac8
addq -0x30(%rbp), %rsi
xorl %r9d, %r9d
cmpq %r9, %rdx
je 0x718a
movsd (%rsi,%r9,8), %xmm5
mulsd %xmm8, %xmm5
movsd %xmm5, (%rsi,%r9,8)
incq %r9
jmp 0x70f3
movq %rcx, %rsi
imulq %r13, %rsi
leaq (%r11,%rsi,8), %rsi
movsd (%rsi,%r10,8), %xmm5
xorpd %xmm0, %xmm5
xorl %esi, %esi
cmpq %rsi, %rbx
je 0x714a
movsd (%r12,%rsi,8), %xmm8
mulsd %xmm5, %xmm8
addsd (%rax,%rsi,8), %xmm8
movsd %xmm8, (%rax,%rsi,8)
incq %rsi
jmp 0x7129
movq 0xd977(%rip), %rsi      # 0x14ac8
leaq (%rsi,%r14), %r9
addq -0x30(%rbp), %rsi
xorl %r10d, %r10d
cmpq %r10, %rdx
je 0x717d
movsd (%rsi,%r10,8), %xmm8
mulsd %xmm5, %xmm8
addsd (%r9,%r10,8), %xmm8
movsd %xmm8, (%r9,%r10,8)
incq %r10
jmp 0x715c
incq %rcx
addq %rdi, %rax
addq %rdi, %r14
movq -0x48(%rbp), %r10
cmpq %r15, %rcx
jl 0x7112
maxsd %xmm1, %xmm7
movl -0x4c(%rbp), %ecx
incl %ecx
addq $0x8, -0x38(%rbp)
decq -0x58(%rbp)
movq -0x70(%rbp), %rax
addq %rax, -0x60(%rbp)
addq %rdi, -0x30(%rbp)
movq -0x98(%rbp), %rsi
decq %rsi
addq %rax, %r12
movq -0x90(%rbp), %rax
addq $0x8, %rax
movq -0x80(%rbp), %r10
movapd %xmm6, %xmm5
movapd %xmm7, %xmm1
jmp 0x6fb1
imull -0x40(%rbp), %r15d
movslq %r15d, %rsi
movq -0x38(%rbp), %r9
addq %r13, %r9
leaq (%r9,%rsi,8), %r9
addq -0x60(%rbp), %r13
xorl %r10d, %r10d
movq -0x58(%rbp), %r15
cmpq %r10, %r15
je 0x7218
movsd (%r13,%r10,8), %xmm6
movsd (%r9,%r10,8), %xmm7
movsd %xmm7, (%r13,%r10,8)
movsd %xmm6, (%r9,%r10,8)
incq %r10
jmp 0x71f4
movq 0xd8a9(%rip), %r9       # 0x14ac8
leaq (%r9,%rsi,8), %rsi
addq -0x30(%rbp), %r9
xorl %r10d, %r10d
cmpq %r10, -0xa0(%rbp)
je 0x7075
movsd (%r9,%r10,8), %xmm6
movsd (%rsi,%r10,8), %xmm7
movsd %xmm7, (%r9,%r10,8)
movsd %xmm6, (%rsi,%r10,8)
incq %r10
jmp 0x722a
leaq -0x1(%r15), %rax
imulq %r13, %rax
shlq $0x3, %rax
cmpq $0x2, %r15
jl 0x72d2
decq %r15
leaq (,%r15,8), %r8
addq 0xd858(%rip), %r8       # 0x14ad0
xorl %r9d, %r9d
xorl %r10d, %r10d
cmpq %r15, %r10
jge 0x72cd
movq %r10, %rcx
imulq %r13, %rcx
movsd (%r8,%rcx,8), %xmm2
xorpd %xmm0, %xmm2
movq 0xd82d(%rip), %rcx      # 0x14ac8
leaq (%rcx,%r9), %rsi
addq %rax, %rcx
xorl %r11d, %r11d
cmpq %r11, %rdx
je 0x72c5
movsd (%rcx,%r11,8), %xmm3
mulsd %xmm2, %xmm3
addsd (%rsi,%r11,8), %xmm3
movsd %xmm3, (%rsi,%r11,8)
incq %r11
jmp 0x72a5
incq %r10
addq %rdi, %r9
jmp 0x727e
subq %rdi, %rax
jmp 0x7260
mulsd %xmm1, %xmm5
movsd 0x4042(%rip), %xmm0     # 0xb320
xorl %eax, %eax
ucomisd %xmm5, %xmm0
setbe %al
negl %eax
jmp 0x72f0
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq