// File: /workspace/github_c_makefile_star2_O3/pipde[P]deos-songlib/lib/rra.c
// Function: fft
static void
fft(double *data,int nn,int isign)
    {
    int n, mmax, m, j, istep, i;
    double wtemp, wr, wpr, wpi, wi, theta;
    double tempr, tempi;
    
    n = nn << 1;
    j = 1;
    for (i = 1; i < n; i += 2)
        {
        if (j > i)
            {
            tempr = data[j];     data[j] = data[i];     data[i] = tempr;
            tempr = data[j+1]; data[j+1] = data[i+1]; data[i+1] = tempr;
            }
        m = n >> 1;
        while (m >= 2 && j > m)
            {
            j -= m;
            m >>= 1;
            }
        j += m;
        }
    mmax = 2;
    while (n > mmax)
        {
        istep = 2*mmax;
        theta = TWOPI/(isign*mmax);
        wtemp = sin(0.5*theta);
        wpr = -2.0*wtemp*wtemp;
        wpi = sin(theta);
        wr = 1.0;
        wi = 0.0;
        for (m = 1; m < mmax; m += 2)
            {
            for (i = m; i <= n; i += istep)
                {
                j =i + mmax;
                tempr = wr*data[j]   - wi*data[j+1];
                tempi = wr*data[j+1] + wi*data[j];
                data[j]   = data[i]   - tempr;
                data[j+1] = data[i+1] - tempi;
                data[i] += tempr;
                data[i+1] += tempi;
                }
            wr = (wtemp = wr)*wpr - wi*wpi + wr;
            wi = wi*wpr + wtemp*wpi + wi;
            }
        mmax = istep;
        }
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
leal (%rsi,%rsi), %ebp
cmpl $0x2, %ebp
jl 0x2ee1
movl %edx, %ebx
movq %rdi, %r14
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
movl %ebp, %eax
movl $0x1, %ecx
movl $0x1, %edx
movslq %ecx, %rdi
cmpq %rdi, %rdx
jge 0x2d52
movsd (%r14,%rdi,8), %xmm0
movsd (%r14,%rdx,8), %xmm1
movsd %xmm1, (%r14,%rdi,8)
movsd %xmm0, (%r14,%rdx,8)
movsd 0x8(%r14,%rdi,8), %xmm0
movsd 0x8(%r14,%rdx,8), %xmm1
movsd %xmm1, 0x8(%r14,%rdi,8)
movsd %xmm0, 0x8(%r14,%rdx,8)
cmpl $0x2, %esi
jb 0x2d70
cmpl %esi, %ecx
jle 0x2d70
movl %esi, %edi
movl %edi, %r8d
subl %edi, %ecx
shrl %edi
cmpl $0x4, %r8d
jb 0x2d72
cmpl %edi, %ecx
jg 0x2d5d
jmp 0x2d72
movl %esi, %edi
addl %edi, %ecx
addq $0x2, %rdx
cmpq %rax, %rdx
jb 0x2d16
cmpl $0x2, %ebp
je 0x2ee1
addq $0x8, %r14
movl $0x2, %r15d
xorpd %xmm0, %xmm0
movhpd 0x13b4(%rip), %xmm0     # xmm0 = xmm0[0],mem[0]
movapd %xmm0, 0x10(%rsp)
movl %r15d, %r12d
leal (%r12,%r12), %r15d
movl %r12d, %eax
imull %ebx, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd 0x13aa(%rip), %xmm1     # 0x4168
divsd %xmm0, %xmm1
movsd %xmm1, 0x8(%rsp)
movapd %xmm1, %xmm0
mulsd 0x139c(%rip), %xmm0     # 0x4170
callq 0x11e0
movsd %xmm0, (%rsp)
movsd 0x8(%rsp), %xmm0
callq 0x11e0
movapd 0x134e(%rip), %xmm9     # 0x4140
cmpl $0x2, %r12d
jl 0x2ed8
movsd (%rsp), %xmm2
movapd %xmm2, %xmm1
mulsd 0x136b(%rip), %xmm1     # 0x4178
mulsd %xmm2, %xmm1
movl %r15d, %eax
movl %r12d, %ecx
unpcklpd %xmm1, %xmm1            # xmm1 = xmm1[0,0]
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
shlq $0x3, %rax
movl $0x1, %edx
movq %r14, %rsi
movapd 0x10(%rsp), %xmm2
movapd %xmm2, %xmm3
xorpd %xmm9, %xmm3
cmpl %edx, %ebp
jl 0x2eaa
movapd %xmm2, %xmm4
unpcklpd %xmm3, %xmm4            # xmm4 = xmm4[0],xmm3[0]
movapd %xmm2, %xmm5
unpckhpd %xmm2, %xmm5            # xmm5 = xmm5[1],xmm2[1]
movl %edx, %edi
movq %rsi, %r8
movsd (%r8), %xmm6
movupd (%r8,%rcx,8), %xmm7
movapd %xmm7, %xmm8
mulpd %xmm4, %xmm8
shufpd $0x1, %xmm8, %xmm8      # xmm8 = xmm8[1,0]
mulpd %xmm5, %xmm7
addpd %xmm8, %xmm7
subsd %xmm7, %xmm6
movsd %xmm6, (%r8,%rcx,8)
movupd (%r8), %xmm6
movapd %xmm6, %xmm8
subpd %xmm7, %xmm8
movhpd %xmm8, 0x8(%r8,%rcx,8)
addpd %xmm6, %xmm7
movupd %xmm7, (%r8)
addq %rax, %r8
addl %r15d, %edi
cmpl %edi, %ebp
jge 0x2e53
movapd %xmm2, %xmm4
shufpd $0x1, %xmm3, %xmm4      # xmm4 = xmm4[1],xmm3[0]
mulpd %xmm0, %xmm4
movapd %xmm2, %xmm3
mulpd %xmm1, %xmm3
addpd %xmm4, %xmm3
addpd %xmm3, %xmm2
addq $0x2, %rdx
addq $0x10, %rsi
cmpl %edx, %r12d
jg 0x2e31
cmpl %r15d, %ebp
jg 0x2da2
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq