// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathmsc.cpp
// Function: rfft(float*, COMPLEX*, int)
void rfft(float *x, COMPLEX *y, int m)
{
static    int      mstore = 0;
int       p,num,k;
float     Realsum, Realdif, Imagsum, Imagdif;
double    factor, arg;
COMPLEX   *ck, *xk, *xnk, *cx;

   /* First call the fft routine using the x array but with
      half the size of the real fft */

    p = m - 1;
    cx = (COMPLEX *) x;
    fft(cx, p);

    /* Next create the coefficients for recombination, if required */
    num = (1 << p);    /* num is half the real sequence length.  */

    if(m != mstore) { // fft size changed,  redo cf array
       mstore = m;  

       factor = 4.0*atan(1.0)/num;
       for (k = 1; k < num; k++){
         arg = factor*k;
         cf[k-1].real = (float)cos(arg);
         cf[k-1].imag = (float)sin(arg);
       }
    }

    /* DC component, no multiplies */
    y[0].real = cx[0].real + cx[0].imag;
    y[0].imag = 0.0;

    /* other frequencies by trig recombination */
    ck = cf;
    xk = cx + 1;
    xnk = cx + num - 1;
    for (k = 1; k < num; k++){
      Realsum = ( xk->real + xnk->real ) / 2.0F;
      Imagsum = ( xk->imag + xnk->imag ) / 2.0F;
      Realdif = ( xk->real - xnk->real ) / 2.0F;
      Imagdif = ( xk->imag - xnk->imag ) / 2.0F;

      y[k].real = Realsum + ck->real * Imagsum
                          - ck->imag * Realdif ;

      y[k].imag = Imagdif - ck->imag * Imagsum
                          - ck->real * Realdif ;
      ck++;
      xk++;
      xnk--;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edx, %r15d
movq %rsi, %rbx
movq %rdi, %r14
leal -0x1(%r15), %r12d
movl %r12d, %esi
callq 0xf0dfd
pushq $0x1
popq %rax
movl %r12d, %ecx
shll %cl, %eax
cmpl %r15d, 0x34feab(%rip)   # 0x440f58
jne 0xf1183
movslq %eax, %r15
movss (%r14), %xmm0
addss 0x4(%r14), %xmm0
movss %xmm0, (%rbx)
andl $0x0, 0x4(%rbx)
leaq 0x238ce0(%rip), %rax    # 0x329db0
movq (%rax), %rax
leaq -0x4(,%r15,8), %rcx
pushq $0x1
popq %rdx
movss 0x6012(%rip), %xmm0     # 0xf70f8
cmpq %r15, %rdx
jge 0xf1174
movss (%r14,%rdx,8), %xmm1
movss 0x4(%r14,%rdx,8), %xmm2
movss -0x4(%r14,%rcx), %xmm3
movss (%r14,%rcx), %xmm4
movaps %xmm1, %xmm5
addss %xmm3, %xmm5
mulss %xmm0, %xmm5
movaps %xmm2, %xmm6
addss %xmm4, %xmm6
mulss %xmm0, %xmm6
subss %xmm3, %xmm1
mulss %xmm0, %xmm1
subss %xmm4, %xmm2
mulss %xmm0, %xmm2
movss -0x8(%rax,%rdx,8), %xmm3
mulss %xmm6, %xmm3
addss %xmm5, %xmm3
movss -0x4(%rax,%rdx,8), %xmm4
mulss %xmm4, %xmm6
mulss %xmm1, %xmm4
subss %xmm4, %xmm3
movss %xmm3, (%rbx,%rdx,8)
subss %xmm6, %xmm2
mulss -0x8(%rax,%rdx,8), %xmm1
subss %xmm1, %xmm2
movss %xmm2, 0x4(%rbx,%rdx,8)
incq %rdx
addq $-0x8, %rcx
jmp 0xf10e6
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x1
popq %r12
movl %r15d, 0x34fdca(%rip)   # 0x440f58
cvtsi2sd %eax, %xmm0
movsd 0x4706(%rip), %xmm1     # 0xf58a0
divsd %xmm0, %xmm1
movsd %xmm1, -0x30(%rbp)
movslq %eax, %r15
leaq 0x238c03(%rip), %r13    # 0x329db0
cmpq %r15, %r12
jge 0xf10b6
cvtsi2sd %r12d, %xmm0
mulsd -0x30(%rbp), %xmm0
movsd %xmm0, -0x38(%rbp)
callq 0x9710
cvtsd2ss %xmm0, %xmm0
movq (%r13), %rax
movss %xmm0, -0x8(%rax,%r12,8)
movsd -0x38(%rbp), %xmm0
callq 0x9080
cvtsd2ss %xmm0, %xmm0
movq (%r13), %rax
movss %xmm0, -0x4(%rax,%r12,8)
incq %r12
jmp 0xf11ad