// File: /workspace/github_c_makefile_star2_O1/georgeweigt[P]eigenmath/eigenmath.c
// Function: absfunc
void
absfunc(void)
{
	int h;
	struct atom *p1, *p2, *p3;

	p1 = pop();

	if (isnum(p1)) {
		push(p1);
		if (isnegativenumber(p1))
			negate();
		return;
	}

	if (istensor(p1)) {
		if (p1->u.tensor->ndim > 1) {
			push_symbol(ABS);
			push(p1);
			list(2);
			return;
		}
		push(p1);
		push(p1);
		conjfunc();
		inner();
		push_rational(1, 2);
		power();
		return;
	}

	push(p1);
	push(p1);
	conjfunc();
	multiply();
	push_rational(1, 2);
	power();

	p2 = pop();
	push(p2);
	floatfunc();
	p3 = pop();
	if (isdouble(p3)) {
		push(p2);
		if (isnegativenumber(p3))
			negate();
		return;
	}

	// abs(1/a) evaluates to 1/abs(a)

	if (car(p1) == symbol(POWER) && isnegativeterm(caddr(p1))) {
		push(p1);
		reciprocate();
		absfunc();
		reciprocate();
		return;
	}

	// abs(a*b) evaluates to abs(a)*abs(b)

	if (car(p1) == symbol(MULTIPLY)) {
		h = tos;
		p1 = cdr(p1);
		while (iscons(p1)) {
			push(car(p1));
			absfunc();
			p1 = cdr(p1);
		}
		multiply_factors(tos - h);
		return;
	}

	if (isnegativeterm(p1) || (car(p1) == symbol(ADD) && isnegativeterm(cadr(p1)))) {
		push(p1);
		negate();
		p1 = pop();
	}

	push_symbol(ABS);
	push(p1);
	list(2);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
callq 0x8b78
movq %rax, %rbx
movzbl 0x10(%rax), %eax
leal -0x4(%rax), %ecx
cmpl $0x2, %ecx
jae 0x9c30
movq %rbx, %rdi
callq 0x8b01
movzbl 0x10(%rbx), %eax
cmpl $0x5, %eax
je 0x9cfc
cmpl $0x4, %eax
jne 0x9d29
cmpb $0x1, 0x12(%rbx)
sete %al
jmp 0x9d07
cmpl $0x7, %eax
jne 0x9c7c
movq (%rbx), %rax
cmpl $0x2, (%rax)
jge 0x9e77
movq %rbx, %rdi
callq 0x8b01
movq %rbx, %rdi
callq 0x8b01
callq 0xed50
callq 0x95e2
callq 0x9ef3
movl $0x1, %edi
movl $0x2, %esi
callq 0xa1f4
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0xa234
movq %rbx, %rdi
callq 0x8b01
movq %rbx, %rdi
callq 0x8b01
callq 0xed50
callq 0x95e2
movl $0x2, %edi
callq 0xa8bb
movl $0x1, %edi
movl $0x2, %esi
callq 0xa1f4
callq 0xa234
callq 0x8b78
movq %rax, %r15
movq %rax, %rdi
callq 0x8b01
callq 0xa7fa
callq 0x8b78
cmpb $0x5, 0x10(%rax)
jne 0x9d32
movq %rax, %r14
movq %r15, %rdi
callq 0x8b01
movzbl 0x10(%r14), %eax
cmpl $0x5, %eax
je 0x9e18
cmpl $0x4, %eax
jne 0x9d29
cmpb $0x1, 0x12(%r14)
jmp 0x9c28
xorpd %xmm0, %xmm0
ucomisd (%rbx), %xmm0
seta %al
testb %al, %al
je 0x9d29
movq 0x1076de(%rip), %rdi    # 0x1113f0
callq 0x8b01
movl $0x2, %edi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0xa8bb
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movb 0x10(%rbx), %r15b
cmpb $0x1, %r15b
leaq 0x36cbf(%rip), %r14     # 0x40a00
movq %r14, %rax
cmoveq %rbx, %rax
movq (%rax), %r12
cmpq 0x3955e(%rip), %r12     # 0x432b0
je 0x9d9c
cmpq 0x3954d(%rip), %r12     # 0x432a8
je 0x9e26
movq %rbx, %rdi
callq 0xa813
testl %eax, %eax
je 0x9e6e
movq %rbx, %rdi
callq 0x8b01
movq 0x107670(%rip), %rdi    # 0x1113f0
callq 0x8b01
movl $0x2, %edi
callq 0xa8bb
callq 0x8b78
movq %rax, %rbx
jmp 0x9e77
leaq 0x8(%rbx), %rax
cmpb $0x1, %r15b
cmovneq %r14, %rax
movq (%rax), %rax
movb 0x10(%rax), %cl
addq $0x8, %rax
cmpb $0x1, %cl
movq %r14, %rdx
cmoveq %rax, %rdx
movq (%rdx), %rdx
cmpb $0x1, 0x10(%rdx)
movq %r14, %rdx
jne 0x9dd9
cmpb $0x1, %cl
leaq 0x36c2e(%rip), %rcx     # 0x40a00
cmoveq %rax, %rcx
movq (%rcx), %rdx
movq (%rdx), %rdi
callq 0xa813
testl %eax, %eax
je 0x9d54
movq %rbx, %rdi
callq 0x8b01
movq 0x1075f8(%rip), %rdi    # 0x1113f0
callq 0x8b01
callq 0xa234
callq 0x9be7
movq 0x1075e2(%rip), %rdi    # 0x1113f0
callq 0x8b01
jmp 0x9c6f
xorpd %xmm0, %xmm0
ucomisd (%r14), %xmm0
jmp 0x9d04
addq $0x8, %rbx
cmpb $0x1, %r15b
cmovneq %r14, %rbx
movl 0x3047f(%rip), %r15d    # 0x3a2b8
movq (%rbx), %rbx
cmpb $0x1, 0x10(%rbx)
jne 0x9e60
movq (%rbx), %rdi
callq 0x8b01
callq 0x9be7
leaq 0x8(%rbx), %rax
cmpb $0x1, 0x10(%rbx)
cmovneq %r14, %rax
movq (%rax), %rbx
jmp 0x9e3c
movl 0x30452(%rip), %edi     # 0x3a2b8
subl %r15d, %edi
jmp 0x9d1c
cmpq 0x3942b(%rip), %r12     # 0x432a0
je 0x9e9d
movq 0x342e2(%rip), %rdi     # 0x3e160
callq 0x8b01
movq %rbx, %rdi
callq 0x8b01
movl $0x2, %edi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x8ad9
movq %rbx, %rax
addq $0x8, %rax
cmpb $0x1, %r15b
cmovneq %r14, %rax
movq (%rax), %rax
cmpb $0x1, 0x10(%rax)
cmoveq %rax, %r14
movq (%r14), %rdi
callq 0xa813
testl %eax, %eax
jne 0x9d71
jmp 0x9e77