// File: Albuso0[P]support/mathmore.cpp
// Function: ChebMore::expand_basic() const
std::vector<double> ChebMore::expand_basic() const // Expansion of cos(L arccos x)
{
    std::vector<double> a(L+1);
	
    if (L % 2 == 0)
    {
        unsigned n = L / 2;
        for (unsigned k = 0; k <= n; k++)
            a[2*k] = pow(-1,n-k) * pow(2,2*k) * n / (n+k) * binom(n+k,2*k); // may be simpler
    }
    else
    {
        unsigned n = (L-1)/2;
        for (unsigned k = 0; k <= n; k++)
            a[2*k+1] = pow(-1,n-k) * pow(2,2*k) * (2*n+1) / (2*k+1) * binom(n+k,2*k); // may be simpler
    }
    return a;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x50(%rbp)
movq %rdi, %rax
movq %rax, -0x60(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x58(%rbp)
movb $0x0, -0x11(%rbp)
movl 0x8(%rax), %eax
incl %eax
cltq
movq %rax, -0x48(%rbp)
leaq -0x12(%rbp), %rdi
movq %rdi, -0x40(%rbp)
callq 0x64a0
movq -0x50(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
callq 0x64c0
jmp 0x5f15
leaq -0x12(%rbp), %rdi
callq 0x47d0
movq -0x58(%rbp), %rax
movl 0x8(%rax), %eax
movl $0x2, %ecx
cltd
idivl %ecx
cmpl $0x0, %edx
jne 0x6046
movq -0x58(%rbp), %rax
movl 0x8(%rax), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x28(%rbp), %eax
ja 0x6041
movl -0x28(%rbp), %eax
movl -0x2c(%rbp), %ecx
subl %ecx, %eax
cvtsi2sd %rax, %xmm1
movsd 0x3100(%rip), %xmm0     # 0x9070
callq 0x22c0
movsd %xmm0, -0x78(%rbp)
movl -0x2c(%rbp), %eax
addl %eax, %eax
cvtsi2sd %rax, %xmm1
movsd 0x309c(%rip), %xmm0     # 0x9028
callq 0x22c0
movaps %xmm0, %xmm1
movsd -0x78(%rbp), %xmm0
mulsd %xmm1, %xmm0
movl -0x28(%rbp), %eax
movl %eax, %edi
cvtsi2sd %rax, %xmm1
mulsd %xmm1, %xmm0
movl -0x2c(%rbp), %esi
addl %esi, %edi
movl %edi, %eax
cvtsi2sd %rax, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x70(%rbp)
addl %esi, %esi
callq 0x5d90
movq %rax, -0x68(%rbp)
jmp 0x5fcd
movq -0x50(%rbp), %rdi
movsd -0x70(%rbp), %xmm0
movq -0x68(%rbp), %rax
cvtsi2sd %rax, %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, -0x80(%rbp)
movl -0x2c(%rbp), %eax
shll %eax
movl %eax, %eax
movl %eax, %esi
callq 0x38c0
movsd -0x80(%rbp), %xmm0
movsd %xmm0, (%rax)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x5f4f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x12(%rbp), %rdi
callq 0x47d0
jmp 0x6167
movq -0x50(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
callq 0x38e0
jmp 0x6167
jmp 0x6147
movq -0x58(%rbp), %rax
movl 0x8(%rax), %eax
subl $0x1, %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x30(%rbp), %eax
ja 0x6145
movl -0x30(%rbp), %eax
movl -0x34(%rbp), %ecx
subl %ecx, %eax
cvtsi2sd %rax, %xmm1
movsd 0x2fed(%rip), %xmm0     # 0x9070
callq 0x22c0
movsd %xmm0, -0x98(%rbp)
movl -0x34(%rbp), %eax
addl %eax, %eax
cvtsi2sd %rax, %xmm1
movsd 0x2f86(%rip), %xmm0     # 0x9028
callq 0x22c0
movaps %xmm0, %xmm1
movsd -0x98(%rbp), %xmm0
mulsd %xmm1, %xmm0
movl -0x30(%rbp), %edi
movl %edi, %eax
leal 0x1(%rax,%rax), %eax
cvtsi2sd %rax, %xmm1
mulsd %xmm1, %xmm0
movl -0x34(%rbp), %eax
movl %eax, %esi
addl %esi, %esi
movl %eax, %ecx
leal 0x1(%rcx,%rcx), %ecx
cvtsi2sd %rcx, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x90(%rbp)
addl %eax, %edi
callq 0x5d90
movq %rax, -0x88(%rbp)
jmp 0x60f6
movq -0x50(%rbp), %rdi
movsd -0x90(%rbp), %xmm0
movq -0x88(%rbp), %rax
cvtsi2sd %rax, %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, -0xa0(%rbp)
movl -0x34(%rbp), %eax
shll %eax
addl $0x1, %eax
movl %eax, %eax
movl %eax, %esi
callq 0x38c0
movsd -0xa0(%rbp), %xmm0
movsd %xmm0, (%rax)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x6062
jmp 0x6147
movb $0x1, -0x11(%rbp)
testb $0x1, -0x11(%rbp)
jne 0x615a
movq -0x50(%rbp), %rdi
callq 0x38e0
movq -0x60(%rbp), %rax
addq $0xa0, %rsp
popq %rbp
retq
movq -0x20(%rbp), %rdi
callq 0x22e0