// File: /workspace/github_c_makefile_star2_O0/georgeweigt[P]eigenmath/eigenmath.c
// Function: eval_user_function
void
eval_user_function(struct atom *p1)
{
	int h, i;
	struct atom *FUNC_NAME, *FUNC_ARGS, *FUNC_DEFN;

	FUNC_NAME = car(p1);
	FUNC_ARGS = cdr(p1);

	FUNC_DEFN = get_usrfunc(FUNC_NAME);

	// undefined function?

	if (FUNC_DEFN == symbol(NIL)) {
		if (FUNC_NAME == symbol(D_LOWER)) {
			expanding++;
			eval_derivative(p1);
			expanding--;
			return;
		}
		h = tos;
		push(FUNC_NAME);
		while (iscons(FUNC_ARGS)) {
			push(car(FUNC_ARGS));
			evalg();
			FUNC_ARGS = cdr(FUNC_ARGS);
		}
		list(tos - h);
		return;
	}

	save_symbol(symbol(ARG1));
	save_symbol(symbol(ARG2));
	save_symbol(symbol(ARG3));
	save_symbol(symbol(ARG4));
	save_symbol(symbol(ARG5));
	save_symbol(symbol(ARG6));
	save_symbol(symbol(ARG7));
	save_symbol(symbol(ARG8));
	save_symbol(symbol(ARG9));

	push(FUNC_DEFN); // make visible to garbage collector

	// eval all args before changing bindings

	for (i = 0; i < 9; i++) {
		push(car(FUNC_ARGS));
		evalg();
		FUNC_ARGS = cdr(FUNC_ARGS);
	}

	set_symbol(symbol(ARG9), pop(), symbol(NIL));
	set_symbol(symbol(ARG8), pop(), symbol(NIL));
	set_symbol(symbol(ARG7), pop(), symbol(NIL));
	set_symbol(symbol(ARG6), pop(), symbol(NIL));
	set_symbol(symbol(ARG5), pop(), symbol(NIL));
	set_symbol(symbol(ARG4), pop(), symbol(NIL));
	set_symbol(symbol(ARG3), pop(), symbol(NIL));
	set_symbol(symbol(ARG2), pop(), symbol(NIL));
	set_symbol(symbol(ARG1), pop(), symbol(NIL));

	evalg(); // eval FUNC_DEFN

	p1 = pop();
	restore_symbol();
	restore_symbol();
	restore_symbol();
	restore_symbol();
	restore_symbol();
	restore_symbol();
	restore_symbol();
	restore_symbol();
	restore_symbol();
	push(p1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x1, %eax
jne 0xa899
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
jmp 0xa8a4
movq 0x54160(%rip), %rax     # 0x5ea00
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x1, %eax
jne 0xa8c7
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x38(%rbp)
jmp 0xa8d2
movq 0x54132(%rip), %rax     # 0x5ea00
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rdi
callq 0x21820
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpq 0x5410e(%rip), %rax     # 0x5ea00
jne 0xa9c6
movq -0x18(%rbp), %rax
cmpq 0x521c5(%rip), %rax     # 0x5cac8
jne 0xa931
movl 0x11a1c5(%rip), %eax    # 0x124ad0
addl $0x1, %eax
movl %eax, 0x11a1bc(%rip)    # 0x124ad0
movq -0x8(%rbp), %rdi
callq 0x160e0
movl 0x11a1ad(%rip), %eax    # 0x124ad0
addl $-0x1, %eax
movl %eax, 0x11a1a4(%rip)    # 0x124ad0
jmp 0xac4b
movl 0x4d981(%rip), %eax     # 0x582b8
movl %eax, -0xc(%rbp)
movq -0x18(%rbp), %rdi
callq 0x9110
movq -0x20(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x1, %eax
jne 0xa9b3
movq -0x20(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x1, %eax
jne 0xa96a
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x40(%rbp)
jmp 0xa975
movq 0x5408f(%rip), %rax     # 0x5ea00
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdi
callq 0x9110
callq 0xa610
movq -0x20(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x1, %eax
jne 0xa99e
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x48(%rbp)
jmp 0xa9a9
movq 0x5405b(%rip), %rax     # 0x5ea00
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x20(%rbp)
jmp 0xa943
movl 0x4d8ff(%rip), %edi     # 0x582b8
subl -0xc(%rbp), %edi
callq 0x90d0
jmp 0xac4b
movq 0x5691b(%rip), %rdi     # 0x612e8
callq 0x12d10
movq 0x56917(%rip), %rdi     # 0x612f0
callq 0x12d10
movq 0x56913(%rip), %rdi     # 0x612f8
callq 0x12d10
movq 0x5690f(%rip), %rdi     # 0x61300
callq 0x12d10
movq 0x5690b(%rip), %rdi     # 0x61308
callq 0x12d10
movq 0x56907(%rip), %rdi     # 0x61310
callq 0x12d10
movq 0x56903(%rip), %rdi     # 0x61318
callq 0x12d10
movq 0x568ff(%rip), %rdi     # 0x61320
callq 0x12d10
movq 0x568fb(%rip), %rdi     # 0x61328
callq 0x12d10
movq -0x28(%rbp), %rdi
callq 0x9110
movl $0x0, -0x10(%rbp)
cmpl $0x9, -0x10(%rbp)
jge 0xaab4
movq -0x20(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x1, %eax
jne 0xaa62
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x50(%rbp)
jmp 0xaa6d
movq 0x53f97(%rip), %rax     # 0x5ea00
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rdi
callq 0x9110
callq 0xa610
movq -0x20(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x1, %eax
jne 0xaa96
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x58(%rbp)
jmp 0xaaa1
movq 0x53f63(%rip), %rax     # 0x5ea00
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0x20(%rbp)
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0xaa42
movq 0x5686d(%rip), %rax     # 0x61328
movq %rax, -0xa0(%rbp)
callq 0x91d0
movq -0xa0(%rbp), %rdi
movq %rax, %rsi
movq 0x53f28(%rip), %rdx     # 0x5ea00
callq 0x1df90
movq 0x5683c(%rip), %rax     # 0x61320
movq %rax, -0x98(%rbp)
callq 0x91d0
movq -0x98(%rbp), %rdi
movq %rax, %rsi
movq 0x53eff(%rip), %rdx     # 0x5ea00
callq 0x1df90
movq 0x5680b(%rip), %rax     # 0x61318
movq %rax, -0x90(%rbp)
callq 0x91d0
movq -0x90(%rbp), %rdi
movq %rax, %rsi
movq 0x53ed6(%rip), %rdx     # 0x5ea00
callq 0x1df90
movq 0x567da(%rip), %rax     # 0x61310
movq %rax, -0x88(%rbp)
callq 0x91d0
movq -0x88(%rbp), %rdi
movq %rax, %rsi
movq 0x53ead(%rip), %rdx     # 0x5ea00
callq 0x1df90
movq 0x567a9(%rip), %rax     # 0x61308
movq %rax, -0x80(%rbp)
callq 0x91d0
movq -0x80(%rbp), %rdi
movq %rax, %rsi
movq 0x53e8a(%rip), %rdx     # 0x5ea00
callq 0x1df90
movq 0x5677e(%rip), %rax     # 0x61300
movq %rax, -0x78(%rbp)
callq 0x91d0
movq -0x78(%rbp), %rdi
movq %rax, %rsi
movq 0x53e67(%rip), %rdx     # 0x5ea00
callq 0x1df90
movq 0x56753(%rip), %rax     # 0x612f8
movq %rax, -0x70(%rbp)
callq 0x91d0
movq -0x70(%rbp), %rdi
movq %rax, %rsi
movq 0x53e44(%rip), %rdx     # 0x5ea00
callq 0x1df90
movq 0x56728(%rip), %rax     # 0x612f0
movq %rax, -0x68(%rbp)
callq 0x91d0
movq -0x68(%rbp), %rdi
movq %rax, %rsi
movq 0x53e21(%rip), %rdx     # 0x5ea00
callq 0x1df90
movq 0x566fd(%rip), %rax     # 0x612e8
movq %rax, -0x60(%rbp)
callq 0x91d0
movq -0x60(%rbp), %rdi
movq %rax, %rsi
movq 0x53dfe(%rip), %rdx     # 0x5ea00
callq 0x1df90
callq 0xa610
callq 0x91d0
movq %rax, -0x8(%rbp)
callq 0x12d70
callq 0x12d70
callq 0x12d70
callq 0x12d70
callq 0x12d70
callq 0x12d70
callq 0x12d70
callq 0x12d70
callq 0x12d70
movq -0x8(%rbp), %rdi
callq 0x9110
addq $0xa0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)