// File: /workspace/github_c_makefile_star2_O1/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 0x8b78
movq %rax, %rbx
movzbl 0x10(%rax), %r14d
cmpl $0x1, %r14d
je 0xdff5
cmpl $0x5, %r14d
je 0xdfc1
cmpl $0x4, %r14d
jne 0xdfee
cmpb $0x1, 0x12(%rbx)
jne 0xe09b
movq 0x330a0(%rip), %rdi     # 0x41050
callq 0x8b01
movq 0x103434(%rip), %rdi    # 0x1113f0
jmp 0xe128
movsd (%rbx), %xmm0
movsd %xmm0, -0x30(%rbp)
callq 0x74ec
xorpd %xmm0, %xmm0
ucomisd -0x30(%rbp), %xmm0
movb $0x5, 0x10(%rax)
ja 0xe145
movq $0x0, (%rax)
jmp 0xe152
leaq 0x32a0b(%rip), %rax     # 0x40a00
movq 0x352b4(%rip), %r12     # 0x432b0
cmpq %r12, (%rax)
je 0xe0a7
cmpb $0x1, %r14b
leaq 0x329f0(%rip), %r15     # 0x40a00
movq %r15, %rax
cmoveq %rbx, %rax
movq (%rax), %rcx
cmpq %r12, %rcx
jne 0xe04b
leaq 0x8(%rbx), %rax
cmpb $0x1, %r14b
cmovneq %r15, %rax
movq (%rax), %rax
movb 0x10(%rax), %dl
cmpb $0x1, %dl
movq %r15, %rsi
cmoveq %rax, %rsi
movq (%rsi), %rsi
cmpq 0x35283(%rip), %rsi     # 0x432c8
je 0xe1be
cmpq 0x35256(%rip), %rcx     # 0x432a8
je 0xe168
cmpq 0x35241(%rip), %rcx     # 0x432a0
jne 0xe09b
movq %rbx, %rdi
callq 0x8b01
callq 0xe371
callq 0x8b78
movq %rax, %r14
movq %rbx, %rdi
callq 0x8b01
callq 0xe28b
callq 0x8b78
movq %rax, %rbx
movq %rax, %rdi
callq 0xaece
testl %eax, %eax
je 0xe201
movq 0x3009e(%rip), %rdi     # 0x3e140
jmp 0xe155
leaq 0x8(%rbx), %r13
cmpb $0x1, %r14b
leaq 0x3294a(%rip), %r15     # 0x40a00
movq %r15, %rax
cmoveq %r13, %rax
movq (%rax), %rax
cmpb $0x1, 0x10(%rax)
cmovneq %r15, %rax
movq (%rax), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl $0x1, %edx
callq 0xcb82
testl %eax, %eax
je 0xe005
movq 0x32f67(%rip), %rdi     # 0x41050
callq 0x8b01
cmpb $0x1, 0x10(%rbx)
cmovneq %r15, %r13
movq (%r13), %rax
movb 0x10(%rax), %cl
addq $0x8, %rax
cmpb $0x1, %cl
movq %r15, %rdx
cmoveq %rax, %rdx
movq (%rdx), %rdx
cmpb $0x1, 0x10(%rdx)
jne 0xe125
cmpb $0x1, %cl
leaq 0x328e2(%rip), %rcx     # 0x40a00
cmoveq %rax, %rcx
movq (%rcx), %r15
movq (%r15), %rdi
callq 0x8b01
movl $0x2, %edi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xa8bb
movabsq $-0x3ff6de04abbbd2e8, %rcx # imm = 0xC00921FB54442D18
movq %rcx, (%rax)
movq %rax, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x8b01
addq $0x8, %rbx
cmpb $0x1, %r14b
cmovneq %r15, %rbx
movl 0x2c13d(%rip), %r14d    # 0x3a2b8
movq (%rbx), %rbx
jmp 0xe19c
movq (%rbx), %rdi
callq 0x8b01
callq 0xdf72
leaq 0x8(%rbx), %rax
cmpb $0x1, 0x10(%rbx)
cmovneq %r15, %rax
movq (%rax), %rbx
cmpb $0x1, 0x10(%rbx)
je 0xe180
movl 0x2c110(%rip), %edi     # 0x3a2b8
subl %r14d, %edi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xa975
addq $0x8, %rax
cmpb $0x1, %dl
movq %r15, %rcx
cmoveq %rax, %rcx
movq (%rcx), %rcx
cmpb $0x1, 0x10(%rcx)
jne 0xe1e6
cmpb $0x1, %dl
leaq 0x32821(%rip), %rcx     # 0x40a00
cmoveq %rax, %rcx
movq (%rcx), %r15
movq (%r15), %rdi
callq 0x8b01
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xe28b
movq %r14, %rdi
callq 0xaece
testl %eax, %eax
je 0xe228
movl $0x1, %edi
movl $0x2, %esi
callq 0xa1f4
movq 0x32e2d(%rip), %rdi     # 0x41050
jmp 0xe128
movq %rbx, %rdi
callq 0x8b01
movq %r14, %rdi
callq 0x8b01
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xd34a