// File: /workspace/github_c_makefile_star2_O1/georgeweigt[P]eigenmath/eigenmath.c
// Function: fmt_function
void
fmt_function(struct atom *p)
{
	// d(f(x),x)

	if (car(p) == symbol(DERIVATIVE)) {
		fmt_roman_char('d');
		fmt_args(p);
		return;
	}

	// n!

	if (car(p) == symbol(FACTORIAL)) {
		p = cadr(p);
		if (isposint(p) || issymbol(p))
			fmt_expr(p);
		else
			fmt_subexpr(p);
		fmt_roman_char('!');
		return;
	}

	// A[1,2]

	if (car(p) == symbol(INDEX)) {
		p = cdr(p);
		if (issymbol(car(p)))
			fmt_symbol(car(p));
		else
			fmt_subexpr(car(p));
		fmt_indices(p);
		return;
	}

	if (car(p) == symbol(SETQ) || car(p) == symbol(TESTEQ)) {
		fmt_expr(cadr(p));
		fmt_infix_operator('=');
		fmt_expr(caddr(p));
		return;
	}

	if (car(p) == symbol(TESTGE)) {
		fmt_expr(cadr(p));
		fmt_infix_operator(GREATEREQUAL);
		fmt_expr(caddr(p));
		return;
	}

	if (car(p) == symbol(TESTGT)) {
		fmt_expr(cadr(p));
		fmt_infix_operator('>');
		fmt_expr(caddr(p));
		return;
	}

	if (car(p) == symbol(TESTLE)) {
		fmt_expr(cadr(p));
		fmt_infix_operator(LESSEQUAL);
		fmt_expr(caddr(p));
		return;
	}

	if (car(p) == symbol(TESTLT)) {
		fmt_expr(cadr(p));
		fmt_infix_operator('<');
		fmt_expr(caddr(p));
		return;
	}

	// default

	if (issymbol(car(p)))
		fmt_symbol(car(p));
	else
		fmt_subexpr(car(p));

	fmt_args(p);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movb 0x10(%rdi), %al
cmpb $0x1, %al
leaq 0x1de7b(%rip), %r14     # 0x40a00
movq %r14, %rcx
cmoveq %rdi, %rcx
movq (%rcx), %rdi
cmpq 0x1bf4a(%rip), %rdi     # 0x3eae0
je 0x22c14
cmpq 0x1c561(%rip), %rdi     # 0x3f100
je 0x22c30
cmpq 0x2070c(%rip), %rdi     # 0x432b8
je 0x22c84
cmpq 0x20707(%rip), %rdi     # 0x432c0
je 0x22cb3
cmpq 0x1f12a(%rip), %rdi     # 0x41cf0
je 0x22cb3
cmpq 0x1f125(%rip), %rdi     # 0x41cf8
je 0x22d14
cmpq 0x1f120(%rip), %rdi     # 0x41d00
je 0x22d68
cmpq 0x1f11b(%rip), %rdi     # 0x41d08
je 0x22deb
cmpq 0x1f116(%rip), %rdi     # 0x41d10
je 0x22e19
movb 0x10(%rdi), %al
andb $-0x2, %al
cmpb $0x2, %al
jne 0x22e48
callq 0x228a2
jmp 0x22c1e
movl $0x64, %edi
callq 0x217e1
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x21746
addq $0x8, %rbx
cmpb $0x1, %al
leaq 0x1ddc3(%rip), %rax     # 0x40a00
cmovneq %rax, %rbx
movq (%rbx), %rcx
cmpb $0x1, 0x10(%rcx)
cmoveq %rcx, %rax
movq (%rax), %rbx
movq %rbx, %rdi
callq 0x13ac6
testl %eax, %eax
jne 0x22c68
movb 0x10(%rbx), %al
andb $-0x2, %al
cmpb $0x2, %al
jne 0x22d47
movq %rbx, %rdi
callq 0x2188f
movl $0x21, %edi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x217e1
addq $0x8, %rbx
cmpb $0x1, %al
leaq 0x1dd6f(%rip), %rax     # 0x40a00
cmovneq %rax, %rbx
movq (%rbx), %rbx
cmpb $0x1, 0x10(%rbx)
cmoveq %rbx, %rax
movq (%rax), %rdi
movb 0x10(%rdi), %al
andb $-0x2, %al
cmpb $0x2, %al
jne 0x22ce9
callq 0x228a2
jmp 0x22d02
leaq 0x8(%rbx), %r15
cmpb $0x1, %al
leaq 0x1dd40(%rip), %r14     # 0x40a00
movq %r14, %rax
cmoveq %r15, %rax
movq (%rax), %rax
cmpb $0x1, 0x10(%rax)
cmovneq %r14, %rax
movq (%rax), %rdi
callq 0x2188f
callq 0x21f9a
movl $0x3d, %edi
jmp 0x22d99
movl 0x175c8(%rip), %r14d    # 0x3a2b8
callq 0x2188f
movl %r14d, %edi
callq 0x2191c
callq 0x21b50
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x23310
leaq 0x8(%rbx), %r15
cmpb $0x1, %al
leaq 0x1dcdf(%rip), %r14     # 0x40a00
movq %r14, %rax
cmoveq %r15, %rax
movq (%rax), %rax
cmpb $0x1, 0x10(%rax)
cmovneq %r14, %rax
movq (%rax), %rdi
callq 0x2188f
callq 0x21f9a
movl $0xe289a5, %edi         # imm = 0xE289A5
jmp 0x22d99
movl 0x1756a(%rip), %r14d    # 0x3a2b8
movq %rbx, %rdi
callq 0x2188f
movl %r14d, %edi
callq 0x2191c
callq 0x21b50
jmp 0x22c70
leaq 0x8(%rbx), %r15
cmpb $0x1, %al
leaq 0x1dc8b(%rip), %r14     # 0x40a00
movq %r14, %rax
cmoveq %r15, %rax
movq (%rax), %rax
cmpb $0x1, 0x10(%rax)
cmovneq %r14, %rax
movq (%rax), %rdi
callq 0x2188f
callq 0x21f9a
movl $0x3e, %edi
callq 0x217e1
callq 0x21f9a
cmpb $0x1, 0x10(%rbx)
cmovneq %r14, %r15
movq (%r15), %rax
movb 0x10(%rax), %cl
addq $0x8, %rax
cmpb $0x1, %cl
movq %r14, %rdx
cmoveq %rax, %rdx
movq (%rdx), %rdx
cmpb $0x1, 0x10(%rdx)
jne 0x22dd9
cmpb $0x1, %cl
leaq 0x1dc2e(%rip), %rcx     # 0x40a00
cmoveq %rax, %rcx
movq (%rcx), %r14
movq (%r14), %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x2188f
leaq 0x8(%rbx), %r15
cmpb $0x1, %al
leaq 0x1dc08(%rip), %r14     # 0x40a00
movq %r14, %rax
cmoveq %r15, %rax
movq (%rax), %rax
cmpb $0x1, 0x10(%rax)
cmovneq %r14, %rax
movq (%rax), %rdi
callq 0x2188f
movl $0xe289a4, %edi         # imm = 0xE289A4
jmp 0x22e3e
leaq 0x8(%rbx), %r15
cmpb $0x1, %al
movq %r14, %rax
cmoveq %r15, %rax
movq (%rax), %rax
cmpb $0x1, 0x10(%rax)
cmovneq %r14, %rax
movq (%rax), %rdi
callq 0x2188f
movl $0x3c, %edi
callq 0x227b2
jmp 0x22da3
movl 0x17469(%rip), %r14d    # 0x3a2b8
callq 0x2188f
movl %r14d, %edi
callq 0x2191c
callq 0x21b50
jmp 0x22c1e