// File: /workspace/github_c_makefile_star2_O2/georgeweigt[P]eigenmath/eigenmath.c
// Function: arg_nib
void
arg_nib(void)
{
	int h;
	struct atom *p1, *x, *y;

	p1 = pop();

	if (isrational(p1)) {
		if (isnegativenumber(p1)) {
			push_symbol(PI);
			negate(); // see comment above
		} else
			push_integer(0);
		return;
	}

	if (isdouble(p1)) {
		if (isnegativenumber(p1))
			push_double(-M_PI);
		else
			push_double(0.0);
		return;
	}

	// (-1) ^ expr

	if (car(p1) == symbol(POWER) && isminusone(cadr(p1))) {
		push_symbol(PI);
		push(caddr(p1));
		multiply();
		return;
	}

	// e ^ expr

	if (car(p1) == symbol(POWER) && cadr(p1) == symbol(EXP1)) {
		push(caddr(p1));
		imag();
		return;
	}

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

	if (car(p1) == symbol(ADD)) {
		push(p1);
		real();
		x = pop();
		push(p1);
		imag();
		y = pop();
		if (iszero(y)) {
			push_integer(0);
			return;
		}
		if (iszero(x)) {
			push_rational(1, 2);
			push_symbol(PI);
			multiply();
			return;
		}
		push(y);
		push(x);
		arctan();
		return;
	}

	push_integer(0); // p1 is real
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
callq 0x868d
movq %rax, %rbx
movzbl 0x10(%rax), %r15d
cmpl $0x1, %r15d
je 0xcfa5
cmpl $0x5, %r15d
je 0xcf81
cmpl $0x4, %r15d
jne 0xcf9e
movq %rbx, %rdi
callq 0x8c2a
testl %eax, %eax
je 0xd026
movq 0x320d7(%rip), %rdi     # 0x3f040
callq 0x861b
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x975f
movq %rbx, %rdi
callq 0x8c2a
testl %eax, %eax
je 0xd111
movsd 0x161bf(%rip), %xmm0    # 0x23158
jmp 0xd114
leaq 0x31a4b(%rip), %rax     # 0x3e9f0
movq 0x342f4(%rip), %r12     # 0x412a0
cmpq %r12, (%rax)
je 0xd03b
cmpb $0x1, %r15b
sete %al
leaq 0x31a2d(%rip), %r14     # 0x3e9f0
movq %r14, %rcx
cmoveq %rbx, %rcx
movq (%rcx), %rcx
cmpq %r12, %rcx
je 0xd097
cmpq 0x342bb(%rip), %rcx     # 0x41298
je 0xd0c5
cmpq 0x342a6(%rip), %rcx     # 0x41290
jne 0xd026
movq %rbx, %rdi
callq 0x861b
callq 0xd2cc
callq 0x868d
movq %rax, %r14
movq %rbx, %rdi
callq 0x861b
callq 0xd208
callq 0x868d
movq %rax, %rbx
movq %rax, %rdi
callq 0xa641
testl %eax, %eax
je 0xd186
xorl %edi, %edi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xa426
leaq 0x8(%rbx), %r13
cmpb $0x1, %r15b
leaq 0x319a6(%rip), %r14     # 0x3e9f0
movq %r14, %rax
cmoveq %r13, %rax
movq (%rax), %rax
cmpb $0x1, 0x10(%rax)
cmovneq %r14, %rax
movq (%rax), %rdi
callq 0xbfac
testl %eax, %eax
je 0xcfb5
movq 0x31fcd(%rip), %rdi     # 0x3f040
callq 0x861b
cmpb $0x1, 0x10(%rbx)
cmovneq %r14, %r13
movq (%r13), %rax
cmpb $0x1, 0x10(%rax)
jne 0xd15b
movq 0x8(%rax), %rax
jmp 0xd162
movq %rbx, %rdx
addq $0x8, %rdx
cmpb $0x1, %r15b
cmovneq %r14, %rdx
movq (%rdx), %rdx
cmpb $0x1, 0x10(%rdx)
movq 0x34204(%rip), %rsi     # 0x412b8
jne 0xd127
cmpq %rsi, (%rdx)
jne 0xcfd6
movq 0x8(%rdx), %rdx
jmp 0xd137
movl 0x2b1dc(%rip), %r15d    # 0x382a8
addq $0x8, %rbx
testb $0x1, %al
cmoveq %r14, %rbx
movq (%rbx), %rbx
cmpb $0x1, 0x10(%rbx)
jne 0xd0f5
movq (%rbx), %rdi
callq 0x861b
callq 0xcf25
cmpb $0x1, 0x10(%rbx)
sete %al
jmp 0xd0cc
movl 0x2b1ad(%rip), %edi     # 0x382a8
subl %r15d, %edi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xa0fd
xorps %xmm0, %xmm0
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xaf59
movq 0x318c2(%rip), %rdx     # 0x3e9f0
cmpq %rsi, %rdx
jne 0xcfd6
cmpb $0x1, 0x10(%rdx)
jne 0xd140
movq %rdx, %r14
movq (%r14), %rdi
callq 0x861b
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xd208
movq 0x3188e(%rip), %rax     # 0x3e9f0
cmpb $0x1, 0x10(%rax)
jne 0xd16b
movq %rax, %r14
movq (%r14), %rdi
callq 0x861b
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x9fae
movq %r14, %rdi
callq 0xa641
testl %eax, %eax
je 0xd1a6
pushq $0x1
popq %rdi
pushq $0x2
popq %rsi
callq 0x9a47
movq 0x31e9c(%rip), %rdi     # 0x3f040
jmp 0xd16e
movq %rbx, %rdi
callq 0x861b
movq %r14, %rdi
callq 0x861b
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xc5ea