// File: /workspace/github_c_makefile_star2_O1/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 0x8cdc
movq %rdi, %r14
movq 0x37d6a(%rip), %rcx     # 0x40a00
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rdi, %rcx
je 0x8cfa
movq %rsi, %rbx
cmpq %rsi, %rcx
je 0x8cf5
movb 0x10(%r14), %cl
movl %ecx, %esi
andb $-0x2, %sil
cmpb $0x4, %sil
jne 0x8ce6
movb 0x10(%rbx), %dl
andb $-0x2, %dl
cmpb $0x4, %dl
jne 0x8ce0
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x8e8f
xorl %eax, %eax
jmp 0x8cfa
cmpb $0x4, %sil
je 0x8cfa
movb 0x10(%rbx), %dl
movl %edx, %edi
andb $-0x2, %dil
cmpb $0x4, %dil
jne 0x8d09
movl $0x1, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %ecx, %r8d
xorb $0x6, %r8b
movl %edx, %r9d
xorb $0x6, %r9b
orb %r8b, %r9b
jne 0x8d35
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, %dl
sete %r10b
xorl %r8d, %r8d
cmpb $0x6, %cl
sete %r9b
orb %r9b, %r10b
je 0x8d5a
movb %r9b, %r8b
negl %r8d
orl $0x1, %r8d
movl %r8d, %eax
jmp 0x8cfa
movl %esi, %r8d
xorb $0x2, %r8b
movl %edi, %r9d
xorb $0x2, %r9b
orb %r8b, %r9b
je 0x8d1c
cmpb $0x2, %sil
je 0x8cfa
movl $0x1, %eax
cmpb $0x2, %dil
je 0x8cfa
movl %ecx, %eax
xorb $0x7, %al
movl %edx, %esi
xorb $0x7, %sil
orb %al, %sil
jne 0x8daa
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x8f09
cmpb $0x7, %dl
sete %dl
xorl %eax, %eax
cmpb $0x7, %cl
sete %cl
orb %cl, %dl
je 0x8dc8
movb %cl, %al
negl %eax
orl $0x1, %eax
jmp 0x8cfa
cmpb $0x1, 0x10(%r14)
sete %al
jne 0x8e32
cmpb $0x1, 0x10(%rbx)
jne 0x8e32
leaq 0x10(%r14), %r13
leaq 0x10(%rbx), %r12
leaq 0x37c19(%rip), %r15     # 0x40a00
movq (%r14), %rdi
movq (%rbx), %rsi
callq 0x8c79
testl %eax, %eax
jne 0x8cfa
addq $0x8, %r14
cmpb $0x1, (%r13)
cmovneq %r15, %r14
movq (%r14), %r14
addq $0x8, %rbx
cmpb $0x1, (%r12)
cmovneq %r15, %rbx
movq (%rbx), %rbx
cmpb $0x1, 0x10(%r14)
sete %al
jne 0x8e32
leaq 0x10(%r14), %r13
leaq 0x10(%rbx), %r12
cmpb $0x1, 0x10(%rbx)
je 0x8de7
cmpb $0x1, 0x10(%rbx)
movzbl %al, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmovnel %ecx, %eax
jmp 0x8cfa