// File: /workspace/github_c_makefile_star2_O0/georgeweigt[P]eigenmath/eigenmath.c
// Function: eval_eigenvec
void
eval_eigenvec(struct atom *p1)
{
	int i, j, n;
	static double *D, *Q;

	push(cadr(p1));
	evalf();
	floatfunc();
	p1 = pop();

	if (!issquarematrix(p1))
		stopf("eigenvec");

	n = p1->u.tensor->dim[0];

	for (i = 0; i < n; i++)
		for (j = 0; j < n; j++)
			if (!isdouble(p1->u.tensor->elem[n * i + j]))
				stopf("eigenvec");

	for (i = 0; i < n - 1; i++)
		for (j = i + 1; j < n; j++)
			if (fabs(p1->u.tensor->elem[n * i + j]->u.d - p1->u.tensor->elem[n * j + i]->u.d) > 1e-10)
				stopf("eigenvec");

	if (D)
		free(D);
	if (Q)
		free(Q);

	D = alloc_mem(n * n * sizeof (double));
	Q = alloc_mem(n * n * sizeof (double));

	// initialize D

	for (i = 0; i < n; i++) {
		D[n * i + i] = p1->u.tensor->elem[n * i + i]->u.d;
		for (j = i + 1; j < n; j++) {
			D[n * i + j] = p1->u.tensor->elem[n * i + j]->u.d;
			D[n * j + i] = p1->u.tensor->elem[n * i + j]->u.d;
		}
	}

	// initialize Q

	for (i = 0; i < n; i++) {
		Q[n * i + i] = 1.0;
		for (j = i + 1; j < n; j++) {
			Q[n * i + j] = 0.0;
			Q[n * j + i] = 0.0;
		}
	}

	eigenvec(D, Q, n);

	p1 = alloc_matrix(n, n);

	for (i = 0; i < n; i++) {
		for (j = 0; j < n; j++) {
			push_double(Q[n * j + i]); // transpose
			p1->u.tensor->elem[n * i + j] = pop();
		}
	}

	push(p1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x1, %eax
jne 0x19847
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x20(%rbp)
jmp 0x19852
movq 0x451b2(%rip), %rax     # 0x5ea00
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x1, %eax
jne 0x19892
movq -0x8(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x1, %eax
jne 0x1987a
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
jmp 0x19885
movq 0x4517f(%rip), %rax     # 0x5ea00
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
jmp 0x1989d
movq 0x45167(%rip), %rax     # 0x5ea00
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
callq 0x9110
callq 0xa660
callq 0xc290
callq 0x91d0
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rdi
callq 0xeac0
cmpl $0x0, %eax
jne 0x198d3
leaq 0x2ba1a(%rip), %rdi     # 0x452e8
callq 0x78d0
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl 0x4(%rax), %eax
movl %eax, -0x14(%rbp)
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x19946
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x19939
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl -0x14(%rbp), %ecx
imull -0xc(%rbp), %ecx
addl -0x10(%rbp), %ecx
movslq %ecx, %rcx
movq 0x68(%rax,%rcx,8), %rax
movzbl 0x10(%rax), %eax
cmpl $0x5, %eax
je 0x1992c
leaq 0x2b9c1(%rip), %rdi     # 0x452e8
callq 0x78d0
jmp 0x1992e
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x198f6
jmp 0x1993b
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x198e7
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
movl -0x14(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x199eb
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
movl -0x10(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x199db
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl -0x14(%rbp), %ecx
imull -0xc(%rbp), %ecx
addl -0x10(%rbp), %ecx
movslq %ecx, %rcx
movq 0x68(%rax,%rcx,8), %rax
movsd (%rax), %xmm0
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl -0x14(%rbp), %ecx
imull -0x10(%rbp), %ecx
addl -0xc(%rbp), %ecx
movslq %ecx, %rcx
movq 0x68(%rax,%rcx,8), %rax
subsd (%rax), %xmm0
movaps 0x2b790(%rip), %xmm1    # 0x45140
pand %xmm1, %xmm0
movsd 0x2b714(%rip), %xmm1    # 0x450d0
ucomisd %xmm1, %xmm0
jbe 0x199ce
leaq 0x2b91f(%rip), %rdi     # 0x452e8
callq 0x78d0
jmp 0x199d0
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x19967
jmp 0x199dd
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x1994d
cmpq $0x0, 0x1159bd(%rip)    # 0x12f3b0
je 0x19a01
movq 0x1159b4(%rip), %rdi    # 0x12f3b0
callq 0x7040
cmpq $0x0, 0x1159af(%rip)    # 0x12f3b8
je 0x19a17
movq 0x1159a6(%rip), %rdi    # 0x12f3b8
callq 0x7040
movl -0x14(%rbp), %eax
imull -0x14(%rbp), %eax
cltq
shlq $0x3, %rax
movl %eax, %edi
callq 0x7930
movq %rax, 0x11597e(%rip)    # 0x12f3b0
movl -0x14(%rbp), %eax
imull -0x14(%rbp), %eax
cltq
shlq $0x3, %rax
movl %eax, %edi
callq 0x7930
movq %rax, 0x11596b(%rip)    # 0x12f3b8
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x19b2e
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl -0x14(%rbp), %ecx
imull -0xc(%rbp), %ecx
addl -0xc(%rbp), %ecx
movslq %ecx, %rcx
movq 0x68(%rax,%rcx,8), %rax
movsd (%rax), %xmm0
movq 0x11592c(%rip), %rax    # 0x12f3b0
movl -0x14(%rbp), %ecx
imull -0xc(%rbp), %ecx
addl -0xc(%rbp), %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
movl -0x10(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x19b1e
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl -0x14(%rbp), %ecx
imull -0xc(%rbp), %ecx
addl -0x10(%rbp), %ecx
movslq %ecx, %rcx
movq 0x68(%rax,%rcx,8), %rax
movsd (%rax), %xmm0
movq 0x1158e5(%rip), %rax    # 0x12f3b0
movl -0x14(%rbp), %ecx
imull -0xc(%rbp), %ecx
addl -0x10(%rbp), %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl -0x14(%rbp), %ecx
imull -0xc(%rbp), %ecx
addl -0x10(%rbp), %ecx
movslq %ecx, %rcx
movq 0x68(%rax,%rcx,8), %rax
movsd (%rax), %xmm0
movq 0x1158af(%rip), %rax    # 0x12f3b0
movl -0x14(%rbp), %ecx
imull -0x10(%rbp), %ecx
addl -0xc(%rbp), %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x19a9f
jmp 0x19b20
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x19a54
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x19bc6
movq 0x115870(%rip), %rax    # 0x12f3b8
movl -0x14(%rbp), %ecx
imull -0xc(%rbp), %ecx
addl -0xc(%rbp), %ecx
movslq %ecx, %rcx
movsd 0x2b553(%rip), %xmm0    # 0x450b0
movsd %xmm0, (%rax,%rcx,8)
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
movl -0x10(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x19bb6
movq 0x11583e(%rip), %rax    # 0x12f3b8
movl -0x14(%rbp), %ecx
imull -0xc(%rbp), %ecx
addl -0x10(%rbp), %ecx
movslq %ecx, %rcx
xorps %xmm0, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movq 0x115822(%rip), %rax    # 0x12f3b8
movl -0x14(%rbp), %ecx
imull -0x10(%rbp), %ecx
addl -0xc(%rbp), %ecx
movslq %ecx, %rcx
xorps %xmm0, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x19b6b
jmp 0x19bb8
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x19b35
movq 0x1157e3(%rip), %rdi    # 0x12f3b0
movq 0x1157e4(%rip), %rsi    # 0x12f3b8
movl -0x14(%rbp), %edx
callq 0x19c70
movl -0x14(%rbp), %edi
movl -0x14(%rbp), %esi
callq 0x7a40
movq %rax, -0x8(%rbp)
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x19c60
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x19c53
movq 0x1157a8(%rip), %rax    # 0x12f3b8
movl -0x14(%rbp), %ecx
imull -0x10(%rbp), %ecx
addl -0xc(%rbp), %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
callq 0xe5e0
callq 0x91d0
movq %rax, %rdx
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl -0x14(%rbp), %ecx
imull -0xc(%rbp), %ecx
addl -0x10(%rbp), %ecx
movslq %ecx, %rcx
movq %rdx, 0x68(%rax,%rcx,8)
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x19c01
jmp 0x19c55
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x19bf2
movq -0x8(%rbp), %rdi
callq 0x9110
addq $0x30, %rsp
popq %rbp
retq
nop