// File: /workspace/github_cpp_makefile_star2_O3/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 0x107845
movl $0x1, %eax
movl %r12d, %ecx
shll %cl, %eax
movl %eax, -0x2c(%rbp)
cmpl %r15d, 0x34f3da(%rip)   # 0x456f58
je 0x107bff
movl %r15d, 0x34f3d1(%rip)   # 0x456f58
movl -0x2c(%rbp), %eax
cmpl $0x1, %eax
jle 0x107cc5
cvtsi2sd %eax, %xmm0
movsd 0x3c89(%rip), %xmm1     # 0x10b828
divsd %xmm0, %xmm1
movsd %xmm1, -0x38(%rbp)
movl %eax, %r15d
movl $0x1, %r12d
leaq 0x2381f8(%rip), %r13    # 0x33fdb0
xorps %xmm0, %xmm0
cvtsi2sd %r12d, %xmm0
mulsd -0x38(%rbp), %xmm0
movsd %xmm0, -0x40(%rbp)
callq 0x9710
cvtsd2ss %xmm0, %xmm0
movq (%r13), %rax
movss %xmm0, -0x8(%rax,%r12,8)
movsd -0x40(%rbp), %xmm0
callq 0x9080
cvtsd2ss %xmm0, %xmm0
movq (%r13), %rax
movss %xmm0, -0x4(%rax,%r12,8)
incq %r12
cmpq %r12, %r15
jne 0x107bb8
movss (%r14), %xmm0
addss 0x4(%r14), %xmm0
movss %xmm0, (%rbx)
movl $0x0, 0x4(%rbx)
movl -0x2c(%rbp), %eax
cmpl $0x2, %eax
jl 0x107cdb
movl %eax, %eax
leaq 0x238186(%rip), %rcx    # 0x33fdb0
movq (%rcx), %rcx
decq %rax
movl $0xc, %edx
movss 0x543b(%rip), %xmm0     # 0x10d078
movss -0x4(%r14,%rdx), %xmm1
movss (%r14,%rdx), %xmm2
movss (%r14,%rax,8), %xmm3
movss 0x4(%r14,%rax,8), %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 -0xc(%rcx,%rdx), %xmm3
mulss %xmm6, %xmm3
addss %xmm5, %xmm3
movss -0x8(%rcx,%rdx), %xmm4
mulss %xmm4, %xmm6
mulss %xmm1, %xmm4
subss %xmm4, %xmm3
movss %xmm3, -0x4(%rbx,%rdx)
subss %xmm6, %xmm2
mulss -0xc(%rcx,%rdx), %xmm1
subss %xmm1, %xmm2
movss %xmm2, (%rbx,%rdx)
addq $0x8, %rdx
decq %rax
jne 0x107c3d
jmp 0x107cdb
movss (%r14), %xmm0
addss 0x4(%r14), %xmm0
movss %xmm0, (%rbx)
movl $0x0, 0x4(%rbx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq