// File: /workspace/github_c_makefile_star2_O3/georgeweigt[P]eigenmath/eigenmath.c
// Function: eval_derivative
void
eval_derivative(struct atom *p1)
{
	int flag, i, n;
	struct atom *X, *Y = NULL; // silence compiler

	push(cadr(p1));
	evalf();
	p1 = cddr(p1);

	if (!iscons(p1)) {
		push_symbol(X_LOWER);
		derivative();
		return;
	}

	flag = 0;

	while (iscons(p1) || flag) {

		if (flag) {
			X = Y;
			flag = 0;
		} else {
			push(car(p1));
			evalf();
			X = pop();
			p1 = cdr(p1);
		}

		if (isnum(X)) {
			push(X);
			n = pop_integer();
			push_symbol(X_LOWER);
			X = pop();
			for (i = 0; i < n; i++) {
				push(X);
				derivative();
			}
			continue;
		}

		if (iscons(p1)) {

			push(car(p1));
			evalf();
			Y = pop();
			p1 = cdr(p1);

			if (isnum(Y)) {
				push(Y);
				n = pop_integer();
				for (i = 0; i < n; i++) {
					push(X);
					derivative();
				}
				continue;
			}

			flag = 1;
		}

		push(X);
		derivative();
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x8(%rdi), %r14
cmpb $0x1, 0x10(%rdi)
leaq 0x342ac(%rip), %r15     # 0x45a00
movq %r15, %rax
cmoveq %r14, %rax
movq (%rax), %rax
cmpb $0x1, 0x10(%rax)
cmovneq %r15, %rax
movq (%rax), %rdi
callq 0x8ba5
callq 0x96e2
cmpb $0x1, 0x10(%rbx)
cmovneq %r15, %r14
movq (%r14), %rax
leaq 0x8(%rax), %rcx
cmpb $0x1, 0x10(%rax)
cmovneq %r15, %rcx
movq (%rcx), %rbx
cmpb $0x1, 0x10(%rbx)
jne 0x1195f
leaq 0x10(%rbx), %r14
movb $0x1, %al
xorl %r15d, %r15d
movl $0xfffe795f, %r13d      # imm = 0xFFFE795F
movq $0x0, -0x30(%rbp)
movq %rbx, %r12
testb $0x1, %al
leaq 0x34246(%rip), %rbx     # 0x45a00
cmovneq %r12, %rbx
testb $0x1, %r15b
je 0x117cd
movq %r12, %rbx
movq -0x30(%rbp), %r14
jmp 0x11817
movq (%rbx), %rdi
callq 0x8ba5
callq 0x96e2
movl 0x2dad8(%rip), %eax     # 0x3f2b8
leal (%rax,%r13), %ecx
cmpl %r13d, %ecx
jbe 0x1197e
decl %eax
movl %eax, 0x2dac3(%rip)     # 0x3f2b8
addq $0x8, %r12
cmpb $0x1, (%r14)
leaq 0x36dbc(%rip), %rcx     # 0x485c0
movq (%rcx,%rax,8), %r14
leaq 0x341f1(%rip), %rax     # 0x45a00
cmovneq %rax, %r12
movq (%r12), %rbx
movb 0x10(%r14), %al
andb $-0x2, %al
cmpb $0x4, %al
jne 0x11893
movq %r14, %rdi
callq 0x8ba5
callq 0xf8e6
movl %eax, %r14d
movq 0x36110(%rip), %rdi     # 0x47948
callq 0x8ba5
movl 0x2da75(%rip), %eax     # 0x3f2b8
leal (%rax,%r13), %ecx
cmpl %r13d, %ecx
jbe 0x1197e
decl %eax
movl %eax, 0x2da60(%rip)     # 0x3f2b8
testl %r14d, %r14d
jle 0x1187a
leaq 0x36d5c(%rip), %rcx     # 0x485c0
movq (%rcx,%rax,8), %r15
movq %r15, %rdi
callq 0x8ba5
callq 0x1198a
decl %r14d
jne 0x11868
leaq 0x10(%rbx), %r14
xorl %r15d, %r15d
cmpb $0x1, 0x10(%rbx)
movq %rbx, %r12
je 0x117be
jmp 0x11950
cmpb $0x1, 0x10(%rbx)
sete %r15b
jne 0x11924
movq (%rbx), %rdi
callq 0x8ba5
callq 0x96e2
movl 0x2da04(%rip), %eax     # 0x3f2b8
leal (%rax,%r13), %ecx
cmpl %r13d, %ecx
jbe 0x1197e
decl %eax
movl %eax, 0x2d9ef(%rip)     # 0x3f2b8
leaq 0x36cf0(%rip), %rcx     # 0x485c0
movq (%rcx,%rax,8), %r12
leaq 0x8(%rbx), %rax
cmpb $0x1, 0x10(%rbx)
leaq 0x3411d(%rip), %rcx     # 0x45a00
cmovneq %rcx, %rax
movq (%rax), %rbx
movb 0x10(%r12), %al
andb $-0x2, %al
cmpb $0x4, %al
movq %r12, -0x30(%rbp)
jne 0x11924
movq %r12, %rdi
callq 0x8ba5
callq 0xf8e6
testl %eax, %eax
jle 0x1191f
movl %eax, %r15d
movq %r14, %rdi
callq 0x8ba5
callq 0x1198a
decl %r15d
jne 0x1190d
xorl %r15d, %r15d
jmp 0x11931
movq %r14, %rdi
callq 0x8ba5
callq 0x1198a
leaq 0x10(%rbx), %r14
movb 0x10(%rbx), %cl
cmpb $0x1, %cl
sete %al
testb %r15b, %r15b
jne 0x117ae
cmpb $0x1, %cl
je 0x117ae
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x35fe2(%rip), %rdi     # 0x47948
callq 0x8ba5
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1198a
leaq 0x1d5bc(%rip), %rdi     # 0x2ef41
callq 0x780b