// File: /workspace/github_c_makefile_star2_O2/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 0x1f66a(%rip), %r14     # 0x3e9f0
movq %r14, %rcx
cmoveq %rdi, %rcx
movq (%rcx), %rdi
cmpq 0x1d739(%rip), %rdi     # 0x3cad0
je 0x1f415
cmpq 0x1dd50(%rip), %rdi     # 0x3d0f0
je 0x1f42f
cmpq 0x21efb(%rip), %rdi     # 0x412a8
je 0x1f481
cmpq 0x21ef6(%rip), %rdi     # 0x412b0
je 0x1f4b0
cmpq 0x20919(%rip), %rdi     # 0x3fce0
je 0x1f4b0
cmpq 0x20914(%rip), %rdi     # 0x3fce8
je 0x1f4f6
cmpq 0x2090f(%rip), %rdi     # 0x3fcf0
je 0x1f531
cmpq 0x2090a(%rip), %rdi     # 0x3fcf8
je 0x1f55f
cmpq 0x20905(%rip), %rdi     # 0x3fd00
je 0x1f5c9
movb 0x10(%rdi), %al
andb $-0x2, %al
cmpb $0x2, %al
jne 0x1f5f0
callq 0x1f11b
jmp 0x1f41d
pushq $0x64
popq %rdi
callq 0x1e44b
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x1e3b1
addq $0x8, %rbx
cmpb $0x1, %al
leaq 0x1f5b4(%rip), %rax     # 0x3e9f0
cmovneq %rax, %rbx
movq (%rbx), %rcx
cmpb $0x1, 0x10(%rcx)
cmoveq %rcx, %rax
movq (%rax), %rbx
movq %rbx, %rdi
callq 0x11f8c
testl %eax, %eax
jne 0x1f467
movb 0x10(%rbx), %al
andb $-0x2, %al
cmpb $0x2, %al
jne 0x1f524
movq %rbx, %rdi
callq 0x1e499
pushq $0x21
popq %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x1e44b
addq $0x8, %rbx
cmpb $0x1, %al
leaq 0x1f562(%rip), %rax     # 0x3e9f0
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 0x1f4df
callq 0x1f11b
jmp 0x1f4e4
leaq 0x8(%rbx), %r15
cmpb $0x1, %al
leaq 0x1f533(%rip), %r14     # 0x3e9f0
movq %r14, %rax
cmoveq %r15, %rax
movq (%rax), %rax
cmpb $0x1, 0x10(%rax)
cmovneq %r14, %rax
movq (%rax), %rdi
callq 0x1e499
pushq $0x3d
popq %rdi
jmp 0x1f58b
callq 0x1e8b3
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x1f9a8
leaq 0x8(%rbx), %r15
cmpb $0x1, %al
leaq 0x1f4ed(%rip), %r14     # 0x3e9f0
movq %r14, %rax
cmoveq %r15, %rax
movq (%rax), %rax
cmpb $0x1, 0x10(%rax)
cmovneq %r14, %rax
movq (%rax), %rdi
callq 0x1e499
movl $0xe289a5, %edi         # imm = 0xE289A5
jmp 0x1f58b
movq %rbx, %rdi
callq 0x1e8b3
jmp 0x1f46f
leaq 0x8(%rbx), %r15
cmpb $0x1, %al
leaq 0x1f4b2(%rip), %r14     # 0x3e9f0
movq %r14, %rax
cmoveq %r15, %rax
movq (%rax), %rax
cmpb $0x1, 0x10(%rax)
cmovneq %r14, %rax
movq (%rax), %rdi
callq 0x1e499
pushq $0x3e
jmp 0x1f4d9
leaq 0x8(%rbx), %r15
cmpb $0x1, %al
leaq 0x1f484(%rip), %r14     # 0x3e9f0
movq %r14, %rax
cmoveq %r15, %rax
movq (%rax), %rax
cmpb $0x1, 0x10(%rax)
cmovneq %r14, %rax
movq (%rax), %rdi
callq 0x1e499
movl $0xe289a4, %edi         # imm = 0xE289A4
callq 0x1f07b
cmpb $0x1, 0x10(%rbx)
cmovneq %r14, %r15
movq (%r15), %rax
cmpb $0x1, 0x10(%rax)
jne 0x1f5a7
movq 0x8(%rax), %rax
jmp 0x1f5ae
movq 0x1f442(%rip), %rax     # 0x3e9f0
cmpb $0x1, 0x10(%rax)
jne 0x1f5b7
movq %rax, %r14
movq (%r14), %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x1e499
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 0x1e499
pushq $0x3c
jmp 0x1f4d9
callq 0x1e8b3
jmp 0x1f41d