// File: /workspace/github_c_makefile_star2_O0/georgeweigt[P]eigenmath/eigenmath.c
// Function: tanfunc
void
tanfunc(void)
{
	int i, n;
	double d;
	struct atom *p1, *p2;

	p1 = pop();

	if (istensor(p1)) {
		p1 = copy_tensor(p1);
		n = p1->u.tensor->nelem;
		for (i = 0; i < n; i++) {
			push(p1->u.tensor->elem[i]);
			tanfunc();
			p1->u.tensor->elem[i] = pop();
		}
		push(p1);
		return;
	}

	if (isdouble(p1)) {
		push(p1);
		d = pop_double();
		d = tan(d);
		push_double(d);
		return;
	}

	if (isdoublez(p1)) {
		push(p1);
		sinfunc();
		push(p1);
		cosfunc();
		divide();
		return;
	}

	// tan(-x) = -tan(x)

	if (isnegativeterm(p1)) {
		push(p1);
		negate();
		tanfunc();
		negate();
		return;
	}

	if (car(p1) == symbol(ADD)) {
		tanfunc_sum(p1);
		return;
	}

	if (car(p1) == symbol(ARCTAN)) {
		push(cadr(p1));
		push(caddr(p1));
		divide();
		return;
	}

	// n pi ?

	push(p1);
	push_symbol(PI);
	divide();
	p2 = pop();

	if (!isnum(p2)) {
		push_symbol(TAN);
		push(p1);
		list(2);
		return;
	}

	if (isdouble(p2)) {
		push(p2);
		d = pop_double();
		d = tan(d * M_PI);
		push_double(d);
		return;
	}

	push(p2); // nonnegative by tan(-x) = -tan(x) above
	push_integer(180);
	multiply();
	p2 = pop();

	if (!isinteger(p2)) {
		push_symbol(TAN);
		push(p1);
		list(2);
		return;
	}

	push(p2);
	push_integer(360);
	modfunc();
	n = pop_integer();

	switch (n) {
	case 0:
	case 180:
		push_integer(0);
		break;
	case 30:
	case 210:
		push_rational(1, 3);
		push_integer(3);
		push_rational(1, 2);
		power();
		multiply();
		break;
	case 150:
	case 330:
		push_rational(-1, 3);
		push_integer(3);
		push_rational(1, 2);
		power();
		multiply();
		break;
	case 45:
	case 225:
		push_integer(1);
		break;
	case 135:
	case 315:
		push_integer(-1);
		break;
	case 60:
	case 240:
		push_integer(3);
		push_rational(1, 2);
		power();
		break;
	case 120:
	case 300:
		push_integer(3);
		push_rational(1, 2);
		power();
		negate();
		break;
	default:
		push_symbol(TAN);
		push(p1);
		list(2);
		break;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
callq 0x91d0
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x7, %eax
jne 0x33eb5
movq -0x18(%rbp), %rdi
callq 0xa550
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rax
movl 0x64(%rax), %eax
movl %eax, -0x8(%rbp)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x33ea7
movq -0x18(%rbp), %rax
movq (%rax), %rax
movslq -0x4(%rbp), %rcx
movq 0x68(%rax,%rcx,8), %rdi
callq 0x9110
callq 0x33e20
callq 0x91d0
movq %rax, %rdx
movq -0x18(%rbp), %rax
movq (%rax), %rax
movslq -0x4(%rbp), %rcx
movq %rdx, 0x68(%rax,%rcx,8)
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x33e62
movq -0x18(%rbp), %rdi
callq 0x9110
jmp 0x34464
movq -0x18(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x5, %eax
jne 0x33ef3
movq -0x18(%rbp), %rdi
callq 0x9110
callq 0x9af0
movsd %xmm0, -0x10(%rbp)
movsd -0x10(%rbp), %xmm0
callq 0x7280
movsd %xmm0, -0x10(%rbp)
movsd -0x10(%rbp), %xmm0
callq 0xe5e0
jmp 0x34464
movq -0x18(%rbp), %rdi
callq 0xf370
cmpl $0x0, %eax
je 0x33f27
movq -0x18(%rbp), %rdi
callq 0x9110
callq 0x14de0
movq -0x18(%rbp), %rdi
callq 0x9110
callq 0x141f0
callq 0x117a0
jmp 0x34464
movq -0x18(%rbp), %rdi
callq 0xc2b0
cmpl $0x0, %eax
je 0x33f52
movq -0x18(%rbp), %rdi
callq 0x9110
callq 0xb4b0
callq 0x33e20
callq 0xb4b0
jmp 0x34464
movq -0x18(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x1, %eax
jne 0x33f6c
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x28(%rbp)
jmp 0x33f77
movq 0x2aa8d(%rip), %rax     # 0x5ea00
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpq 0x2d31e(%rip), %rax     # 0x612a0
jne 0x33f92
movq -0x18(%rbp), %rdi
callq 0x34470
jmp 0x34464
movq -0x18(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x1, %eax
jne 0x33fac
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
jmp 0x33fb7
movq 0x2aa4d(%rip), %rax     # 0x5ea00
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpq 0x281d6(%rip), %rax     # 0x5c198
jne 0x3415e
movq -0x18(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x1, %eax
jne 0x33fe3
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x38(%rbp)
jmp 0x33fee
movq 0x2aa16(%rip), %rax     # 0x5ea00
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x1, %eax
jne 0x3402e
movq -0x18(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x1, %eax
jne 0x34016
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x40(%rbp)
jmp 0x34021
movq 0x2a9e3(%rip), %rax     # 0x5ea00
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x48(%rbp)
jmp 0x34039
movq 0x2a9cb(%rip), %rax     # 0x5ea00
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
callq 0x9110
movq -0x18(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x1, %eax
jne 0x3405d
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x50(%rbp)
jmp 0x34068
movq 0x2a99c(%rip), %rax     # 0x5ea00
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x1, %eax
jne 0x340a9
movq -0x18(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x1, %eax
jne 0x34090
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x58(%rbp)
jmp 0x3409b
movq 0x2a969(%rip), %rax     # 0x5ea00
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x60(%rbp)
jmp 0x340b4
movq 0x2a950(%rip), %rax     # 0x5ea00
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x1, %eax
jne 0x34140
movq -0x18(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x1, %eax
jne 0x340dc
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x68(%rbp)
jmp 0x340e7
movq 0x2a91d(%rip), %rax     # 0x5ea00
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x1, %eax
jne 0x34128
movq -0x18(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x1, %eax
jne 0x3410f
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x70(%rbp)
jmp 0x3411a
movq 0x2a8ea(%rip), %rax     # 0x5ea00
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x78(%rbp)
jmp 0x34133
movq 0x2a8d1(%rip), %rax     # 0x5ea00
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x80(%rbp)
jmp 0x3414b
movq 0x2a8b9(%rip), %rax     # 0x5ea00
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rdi
callq 0x9110
callq 0x117a0
jmp 0x34464
movq -0x18(%rbp), %rdi
callq 0x9110
movq 0x2aee2(%rip), %rdi     # 0x5f050
callq 0x9110
callq 0x117a0
callq 0x91d0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x4, %eax
je 0x341bf
movq -0x20(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x5, %eax
je 0x341bf
movq 0x2bb2e(%rip), %rdi     # 0x5fcd0
callq 0x9110
movq -0x18(%rbp), %rdi
callq 0x9110
movl $0x2, %edi
callq 0x90d0
jmp 0x34464
movq -0x20(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x5, %eax
jne 0x34205
movq -0x20(%rbp), %rdi
callq 0x9110
callq 0x9af0
movsd %xmm0, -0x10(%rbp)
movsd 0x10eb9(%rip), %xmm0    # 0x450a0
mulsd -0x10(%rbp), %xmm0
callq 0x7280
movsd %xmm0, -0x10(%rbp)
movsd -0x10(%rbp), %xmm0
callq 0xe5e0
jmp 0x34464
movq -0x20(%rbp), %rdi
callq 0x9110
movl $0xb4, %edi
callq 0xca50
callq 0xc280
callq 0x91d0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0x9bc0
cmpl $0x0, %eax
jne 0x34258
movq 0x2ba95(%rip), %rdi     # 0x5fcd0
callq 0x9110
movq -0x18(%rbp), %rdi
callq 0x9110
movl $0x2, %edi
callq 0x90d0
jmp 0x34464
movq -0x20(%rbp), %rdi
callq 0x9110
movl $0x168, %edi            # imm = 0x168
callq 0xca50
callq 0x14c60
callq 0x13520
movl %eax, -0x8(%rbp)
movl -0x8(%rbp), %eax
movl %eax, -0x84(%rbp)
testl %eax, %eax
je 0x34371
jmp 0x3428b
movl -0x84(%rbp), %eax
subl $0x1e, %eax
je 0x3437d
jmp 0x3429c
movl -0x84(%rbp), %eax
subl $0x2d, %eax
je 0x343e8
jmp 0x342ad
movl -0x84(%rbp), %eax
subl $0x3c, %eax
je 0x34400
jmp 0x342be
movl -0x84(%rbp), %eax
subl $0x78, %eax
je 0x34420
jmp 0x342cf
movl -0x84(%rbp), %eax
subl $0x87, %eax
je 0x343f4
jmp 0x342e2
movl -0x84(%rbp), %eax
subl $0x96, %eax
je 0x343b4
jmp 0x342f5
movl -0x84(%rbp), %eax
subl $0xb4, %eax
je 0x34371
jmp 0x34304
movl -0x84(%rbp), %eax
subl $0xd2, %eax
je 0x3437d
jmp 0x34313
movl -0x84(%rbp), %eax
subl $0xe1, %eax
je 0x343e8
jmp 0x34326
movl -0x84(%rbp), %eax
subl $0xf0, %eax
je 0x34400
jmp 0x34339
movl -0x84(%rbp), %eax
subl $0x12c, %eax            # imm = 0x12C
je 0x34420
jmp 0x3434c
movl -0x84(%rbp), %eax
subl $0x13b, %eax            # imm = 0x13B
je 0x343f4
jmp 0x3435f
movl -0x84(%rbp), %eax
subl $0x14a, %eax            # imm = 0x14A
je 0x343b4
jmp 0x34445
xorl %edi, %edi
callq 0xca50
jmp 0x34464
movl $0x1, %edi
movl $0x3, %esi
callq 0xb840
movl $0x3, %edi
callq 0xca50
movl $0x1, %edi
movl $0x2, %esi
callq 0xb840
callq 0xb8b0
callq 0xc280
jmp 0x34464
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movl $0x3, %esi
callq 0xb840
movl $0x3, %edi
callq 0xca50
movl $0x1, %edi
movl $0x2, %esi
callq 0xb840
callq 0xb8b0
callq 0xc280
jmp 0x34464
movl $0x1, %edi
callq 0xca50
jmp 0x34464
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0xca50
jmp 0x34464
movl $0x3, %edi
callq 0xca50
movl $0x1, %edi
movl $0x2, %esi
callq 0xb840
callq 0xb8b0
jmp 0x34464
movl $0x3, %edi
callq 0xca50
movl $0x1, %edi
movl $0x2, %esi
callq 0xb840
callq 0xb8b0
callq 0xb4b0
jmp 0x34464
movq 0x2b884(%rip), %rdi     # 0x5fcd0
callq 0x9110
movq -0x18(%rbp), %rdi
callq 0x9110
movl $0x2, %edi
callq 0x90d0
addq $0x90, %rsp
popq %rbp
retq
nopl (%rax)