// File: /workspace/github_c_makefile_star2_O3/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 0x1fb48(%rip), %r14     # 0x45a00
movq %r14, %rcx
cmoveq %rdi, %rcx
movq (%rcx), %rdi
cmpq 0x1dc17(%rip), %rdi     # 0x43ae0
je 0x25f47
cmpq 0x1e22e(%rip), %rdi     # 0x44100
je 0x25f63
cmpq 0x223d9(%rip), %rdi     # 0x482b8
je 0x25fb0
cmpq 0x223d4(%rip), %rdi     # 0x482c0
je 0x25fe2
cmpq 0x20df7(%rip), %rdi     # 0x46cf0
je 0x25fe2
cmpq 0x20df2(%rip), %rdi     # 0x46cf8
je 0x26074
cmpq 0x20ded(%rip), %rdi     # 0x46d00
je 0x260a7
cmpq 0x20de8(%rip), %rdi     # 0x46d08
je 0x2611b
cmpq 0x20de3(%rip), %rdi     # 0x46d10
je 0x26149
movb 0x10(%rdi), %al
andb $-0x2, %al
cmpb $0x2, %al
jne 0x26178
callq 0x25bf1
jmp 0x25f51
movl $0x64, %edi
callq 0x24a13
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x24978
addq $0x8, %rbx
cmpb $0x1, %al
leaq 0x1fa90(%rip), %rax     # 0x45a00
cmovneq %rax, %rbx
movq (%rbx), %rcx
cmpb $0x1, 0x10(%rcx)
cmoveq %rcx, %rax
movq (%rax), %rdi
movb 0x10(%rdi), %al
cmpb $0x4, %al
jne 0x26018
movq 0x8(%rdi), %rax
cmpl $0x1, -0x4(%rax)
jne 0x2601e
cmpl $0x1, (%rax)
jne 0x2601e
cmpb $0x1, 0x12(%rdi)
je 0x2601e
callq 0x24ac1
jmp 0x26035
addq $0x8, %rbx
cmpb $0x1, %al
leaq 0x1fa43(%rip), %rax     # 0x45a00
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 0x26049
callq 0x25bf1
jmp 0x26062
leaq 0x8(%rbx), %r15
cmpb $0x1, %al
leaq 0x1fa11(%rip), %r14     # 0x45a00
movq %r14, %rax
cmoveq %r15, %rax
movq (%rax), %rax
cmpb $0x1, 0x10(%rax)
cmovneq %r14, %rax
movq (%rax), %rdi
callq 0x24ac1
callq 0x25279
movl $0x3d, %edi
jmp 0x260d8
andb $-0x2, %al
cmpb $0x2, %al
je 0x25fa6
movl 0x19294(%rip), %ebx     # 0x3f2b8
callq 0x24ac1
movl %ebx, %edi
callq 0x24b6d
callq 0x24e30
movl $0x21, %edi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x24a13
movl 0x19268(%rip), %r14d    # 0x3f2b8
callq 0x24ac1
movl %r14d, %edi
callq 0x24b6d
callq 0x24e30
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x266b0
leaq 0x8(%rbx), %r15
cmpb $0x1, %al
leaq 0x1f97f(%rip), %r14     # 0x45a00
movq %r14, %rax
cmoveq %r15, %rax
movq (%rax), %rax
cmpb $0x1, 0x10(%rax)
cmovneq %r14, %rax
movq (%rax), %rdi
callq 0x24ac1
callq 0x25279
movl $0xe289a5, %edi         # imm = 0xE289A5
jmp 0x260d8
leaq 0x8(%rbx), %r15
cmpb $0x1, %al
leaq 0x1f94c(%rip), %r14     # 0x45a00
movq %r14, %rax
cmoveq %r15, %rax
movq (%rax), %rax
cmpb $0x1, 0x10(%rax)
cmovneq %r14, %rax
movq (%rax), %rdi
callq 0x24ac1
callq 0x25279
movl $0x3e, %edi
callq 0x24a13
callq 0x25279
cmpb $0x1, 0x10(%rbx)
cmovneq %r14, %r15
movq (%r15), %rax
cmpb $0x1, 0x10(%rax)
jne 0x260f9
movq 0x8(%rax), %rax
jmp 0x26100
movq 0x1f900(%rip), %rax     # 0x45a00
cmpb $0x1, 0x10(%rax)
jne 0x26109
movq %rax, %r14
movq (%r14), %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x24ac1
leaq 0x8(%rbx), %r15
cmpb $0x1, %al
leaq 0x1f8d8(%rip), %r14     # 0x45a00
movq %r14, %rax
cmoveq %r15, %rax
movq (%rax), %rax
cmpb $0x1, 0x10(%rax)
cmovneq %r14, %rax
movq (%rax), %rdi
callq 0x24ac1
movl $0xe289a4, %edi         # imm = 0xE289A4
jmp 0x2616e
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 0x24ac1
movl $0x3c, %edi
callq 0x25b01
jmp 0x260e2
movl 0x19139(%rip), %r14d    # 0x3f2b8
callq 0x24ac1
movl %r14d, %edi
callq 0x24b6d
callq 0x24e30
jmp 0x25f51