// File: /workspace/github_c_makefile_star2_O3/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 %r13
pushq %r12
pushq %rbx
pushq %rax
movl 0x35473(%rip), %eax     # 0x3f2b8
movl $0xfffe795f, %ecx       # imm = 0xFFFE795F
leal (%rax,%rcx), %edx
cmpl %ecx, %edx
jbe 0xa196
decl %eax
movl %eax, 0x3545b(%rip)     # 0x3f2b8
leaq 0x3e75c(%rip), %r15     # 0x485c0
movq (%r15,%rax,8), %rbx
movzbl 0x10(%rbx), %eax
leal -0x4(%rax), %ecx
cmpl $0x2, %ecx
jae 0x9ea1
movq %rbx, %rdi
callq 0x8ba5
movzbl 0x10(%rbx), %eax
cmpl $0x5, %eax
je 0x9fb7
cmpl $0x4, %eax
jne 0x9fa8
cmpb $0x1, 0x12(%rbx)
jne 0x9fa8
jmp 0x9fc1
cmpl $0x7, %eax
jne 0x9ef3
movq (%rbx), %rax
cmpl $0x2, (%rax)
jge 0xa141
movq %rbx, %rdi
callq 0x8ba5
movq %rbx, %rdi
callq 0x8ba5
callq 0xfb25
callq 0x96e2
callq 0xa1cc
movl $0x1, %edi
movl $0x2, %esi
callq 0xa533
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xa573
movq %rbx, %rdi
callq 0x8ba5
movq %rbx, %rdi
callq 0x8ba5
callq 0xfb25
callq 0x96e2
movl $0x2, %edi
callq 0xacef
movl $0x1, %edi
movl $0x2, %esi
callq 0xa533
callq 0xa573
movl 0x35387(%rip), %eax     # 0x3f2b8
movl $0xfffe795f, %r13d      # imm = 0xFFFE795F
leal (%rax,%r13), %ecx
cmpl %r13d, %ecx
jbe 0xa196
decl %eax
movl %eax, 0x3536c(%rip)     # 0x3f2b8
movq (%r15,%rax,8), %r14
movq %r14, %rdi
callq 0x8ba5
callq 0xac30
movl 0x35354(%rip), %r12d    # 0x3f2b8
leal (%r12,%r13), %eax
cmpl %r13d, %eax
jbe 0xa196
decl %r12d
movl %r12d, 0x3533d(%rip)    # 0x3f2b8
movq (%r15,%r12,8), %r13
cmpb $0x5, 0x10(%r13)
jne 0x9fe5
movq %r14, %rdi
callq 0x8ba5
movzbl 0x10(%r13), %eax
cmpl $0x5, %eax
je 0xa087
cmpl $0x4, %eax
jne 0x9fa8
cmpb $0x1, 0x12(%r13)
je 0x9fc1
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorpd %xmm0, %xmm0
ucomisd (%rbx), %xmm0
jbe 0x9fa8
movq 0x10c428(%rip), %rdi    # 0x1163f0
callq 0x8ba5
movl $0x2, %edi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xacef
movb 0x10(%rbx), %cl
cmpb $0x1, %cl
leaq 0x3ba0e(%rip), %r14     # 0x45a00
movq %r14, %rax
cmoveq %rbx, %rax
movq (%rax), %r13
cmpq 0x3e2ad(%rip), %r13     # 0x482b0
je 0xa06a
cmpq 0x3e29c(%rip), %r13     # 0x482a8
je 0xa09c
movl %ecx, %r12d
movq %rbx, %rdi
callq 0xac49
testl %eax, %eax
je 0xa138
movq %rbx, %rdi
callq 0x8ba5
movq 0x10c3bc(%rip), %rdi    # 0x1163f0
callq 0x8ba5
movl $0x2, %edi
callq 0xacef
movl 0x3526f(%rip), %eax     # 0x3f2b8
movl $0xfffe795f, %ecx       # imm = 0xFFFE795F
leal (%rax,%rcx), %edx
cmpl %ecx, %edx
jbe 0xa196
decl %eax
movl %eax, 0x35257(%rip)     # 0x3f2b8
movq (%r15,%rax,8), %rbx
jmp 0xa141
leaq 0x8(%rbx), %rax
movb %cl, -0x29(%rbp)
cmpb $0x1, %cl
cmovneq %r14, %rax
movq (%rax), %rax
cmpb $0x1, 0x10(%rax)
jne 0xa0e3
movq 0x8(%rax), %rax
jmp 0xa0ea
xorpd %xmm0, %xmm0
ucomisd (%r13), %xmm0
jbe 0x9fa8
jmp 0x9fc1
addq $0x8, %rbx
cmpb $0x1, %cl
cmovneq %r14, %rbx
movq (%rbx), %rbx
cmpb $0x1, 0x10(%rbx)
movl %r12d, %edi
jne 0xa0db
movq (%rbx), %rdi
callq 0x8ba5
callq 0x9e31
leaq 0x8(%rbx), %rax
cmpb $0x1, 0x10(%rbx)
cmovneq %r14, %rax
movq (%rax), %rbx
cmpb $0x1, 0x10(%rbx)
je 0xa0b3
movl 0x351dd(%rip), %edi     # 0x3f2b8
subl %r12d, %edi
jmp 0x9fd2
movq 0x3b916(%rip), %rax     # 0x45a00
cmpb $0x1, 0x10(%rax)
movq %r14, %rcx
jne 0xa0f6
movq %rax, %rcx
movq (%rcx), %rdi
callq 0xac49
testl %eax, %eax
movb -0x29(%rbp), %cl
je 0xa005
movq %rbx, %rdi
callq 0x8ba5
movq 0x10c2d8(%rip), %rdi    # 0x1163f0
callq 0x8ba5
callq 0xa573
callq 0x9e31
movq 0x10c2c2(%rip), %rdi    # 0x1163f0
callq 0x8ba5
jmp 0x9ee0
cmpq 0x3e161(%rip), %r13     # 0x482a0
je 0xa16d
movq 0x39018(%rip), %rdi     # 0x43160
callq 0x8ba5
movq %rbx, %rdi
callq 0x8ba5
movl $0x2, %edi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x8b7d
leaq 0x8(%rbx), %rax
cmpb $0x1, %r12b
cmovneq %r14, %rax
movq (%rax), %rax
cmpb $0x1, 0x10(%rax)
cmoveq %rax, %r14
movq (%r14), %rdi
callq 0xac49
testl %eax, %eax
jne 0xa025
jmp 0xa141
leaq 0x24da4(%rip), %rdi     # 0x2ef41
callq 0x780b