// File: /workspace/github_c_makefile_star2_O3/georgeweigt[P]eigenmath/eigenmath.c
// Function: cmp
int
cmp(struct atom *p1, struct atom *p2)
{
	int t;

	if (p1 == p2)
		return 0;

	if (p1 == symbol(NIL))
		return -1;

	if (p2 == symbol(NIL))
		return 1;

	if (isnum(p1) && isnum(p2))
		return cmp_numbers(p1, p2);

	if (isnum(p1))
		return -1;

	if (isnum(p2))
		return 1;

	if (isstr(p1) && isstr(p2))
		return strcmp(p1->u.str, p2->u.str);

	if (isstr(p1))
		return -1;

	if (isstr(p2))
		return 1;

	if (issymbol(p1) && issymbol(p2))
		return strcmp(printname(p1), printname(p2));

	if (issymbol(p1))
		return -1;

	if (issymbol(p2))
		return 1;

	if (istensor(p1) && istensor(p2))
		return cmp_tensors(p1, p2);

	if (istensor(p1))
		return -1;

	if (istensor(p2))
		return 1;

	while (iscons(p1) && iscons(p2)) {
		t = cmp(car(p1), car(p2));
		if (t)
			return t;
		p1 = cdr(p1);
		p2 = cdr(p2);
	}

	if (iscons(p2))
		return -1; // lengthf(p1) < lengthf(p2)

	if (iscons(p1))
		return 1; // lengthf(p1) > lengthf(p2)

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
cmpq %rsi, %rdi
je 0x8daf
movq %rdi, %r14
movq 0x3cc9b(%rip), %rcx     # 0x45a00
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rdi, %rcx
je 0x8dbe
movq %rsi, %rbx
cmpq %rsi, %rcx
je 0x8db9
movb 0x10(%r14), %dl
movl %edx, %edi
andb $-0x2, %dil
movb 0x10(%rbx), %cl
movl %ecx, %esi
andb $-0x2, %sil
cmpb $0x4, %dil
jne 0x8db3
cmpb $0x4, %sil
jne 0x8dbe
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x8f45
xorl %eax, %eax
jmp 0x8dbe
cmpb $0x4, %sil
jne 0x8dcd
movl $0x1, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %edx, %r8d
xorb $0x6, %r8b
movl %ecx, %r9d
xorb $0x6, %r9b
orb %r8b, %r9b
jne 0x8df9
movq (%r14), %rdi
movq (%rbx), %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x71e0
cmpb $0x6, %cl
sete %r10b
xorl %r8d, %r8d
cmpb $0x6, %dl
sete %r9b
orb %r9b, %r10b
je 0x8e1e
movb %r9b, %r8b
negl %r8d
orl $0x1, %r8d
movl %r8d, %eax
jmp 0x8dbe
cmpb $0x2, %dil
jne 0x8e2c
cmpb $0x2, %sil
jne 0x8dbe
jmp 0x8de0
movl $0x1, %eax
cmpb $0x2, %sil
je 0x8dbe
movl %edx, %eax
xorb $0x7, %al
movl %ecx, %esi
xorb $0x7, %sil
orb %al, %sil
jne 0x8e5f
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x8fbf
cmpb $0x7, %cl
sete %dil
xorl %eax, %eax
cmpb $0x7, %dl
sete %sil
orb %sil, %dil
je 0x8e81
movb %sil, %al
negl %eax
orl $0x1, %eax
jmp 0x8dbe
xorl %esi, %esi
cmpb $0x1, %dl
jne 0x8eec
leaq 0x10(%r14), %r13
leaq 0x3cb6d(%rip), %r12     # 0x45a00
movb 0x10(%rbx), %r15b
cmpb $0x1, %r15b
jne 0x8edf
movq (%r14), %rdi
movq (%rbx), %rsi
callq 0x8d48
testl %eax, %eax
jne 0x8dbe
addq $0x8, %r14
cmpb $0x1, (%r13)
cmovneq %r12, %r14
movq (%r14), %r14
leaq 0x8(%rbx), %rax
cmpb $0x1, 0x10(%rbx)
cmovneq %r12, %rax
movq (%rax), %rbx
leaq 0x10(%r14), %r13
cmpb $0x1, 0x10(%r14)
je 0x8e93
movb 0x10(%rbx), %cl
jmp 0x8ee2
movl %r15d, %ecx
xorl %esi, %esi
cmpb $0x1, %r15b
setne %sil
cmpb $0x1, %cl
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmovnel %esi, %eax
jmp 0x8dbe