// File: /workspace/github_cpp_makefile_star2_O3/Sleepwalking[P]world-octave/fft.cpp
// Function: makewt(int, int*, double*)
void makewt(int nw, int *ip, double *w) {
  void makeipt(int nw, int *ip);
  int j, nwh, nw0, nw1;
  double delta, wn4r, wk1r, wk1i, wk3r, wk3i;

  ip[0] = nw;
  ip[1] = 1;
  if (nw > 2) {
    nwh = nw >> 1;
    delta = atan(1.0) / nwh;
    wn4r = cos(delta * nwh);
    w[0] = 1;
    w[1] = wn4r;
    if (nwh == 4) {
      w[2] = cos(delta * 2);
      w[3] = sin(delta * 2);
    } else if (nwh > 4) {
      makeipt(nw, ip);
      w[2] = 0.5 / cos(delta * 2);
      w[3] = 0.5 / cos(delta * 6);
      for (j = 4; j < nwh; j += 4) {
        w[j] = cos(delta * j);
        w[j + 1] = sin(delta * j);
        w[j + 2] = cos(3 * delta * j);
        w[j + 3] = -sin(3 * delta * j);
      }
    }
    nw0 = 0;
    while (nwh > 2) {
      nw1 = nw0 + nwh;
      nwh >>= 1;
      w[nw1] = 1;
      w[nw1 + 1] = wn4r;
      if (nwh == 4) {
        wk1r = w[nw0 + 4];
        wk1i = w[nw0 + 5];
        w[nw1 + 2] = wk1r;
        w[nw1 + 3] = wk1i;
      } else if (nwh > 4) {
        wk1r = w[nw0 + 4];
        wk3r = w[nw0 + 6];
        w[nw1 + 2] = 0.5 / wk1r;
        w[nw1 + 3] = 0.5 / wk3r;
        for (j = 4; j < nwh; j += 4) {
          wk1r = w[nw0 + 2 * j];
          wk1i = w[nw0 + 2 * j + 1];
          wk3r = w[nw0 + 2 * j + 2];
          wk3i = w[nw0 + 2 * j + 3];
          w[nw1 + j] = wk1r;
          w[nw1 + j + 1] = wk1i;
          w[nw1 + j + 2] = wk3r;
          w[nw1 + j + 3] = wk3i;
        }
      }
      nw0 = nw1;
    }
  }
}

// Assembly:
movl %edi, (%rsi)
movl $0x1, 0x4(%rsi)
cmpl $0x3, %edi
jl 0x851f
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movl %edi, %ebp
movl %edi, %r15d
shrl %r15d
cvtsi2sd %r15d, %xmm0
movsd 0x71cf(%rip), %xmm1     # 0xf4f0
divsd %xmm0, %xmm1
movsd %xmm1, (%rsp)
mulsd %xmm1, %xmm0
callq 0x11b0
movabsq $0x3ff0000000000000, %r12 # imm = 0x3FF0000000000000
movq %r12, (%rbx)
movsd %xmm0, 0x10(%rsp)
movsd %xmm0, 0x8(%rbx)
cmpl $0x4, %r15d
jne 0x837d
movsd (%rsp), %xmm0
addsd %xmm0, %xmm0
movsd %xmm0, (%rsp)
callq 0x11b0
movsd %xmm0, 0x10(%rbx)
movsd (%rsp), %xmm0
callq 0x1060
movsd %xmm0, 0x18(%rbx)
jmp 0x8469
cmpl $0xa, %ebp
jb 0x8469
movl %ebp, %edi
movq %r14, %rsi
callq 0x8fd8
movsd (%rsp), %xmm0
addsd %xmm0, %xmm0
callq 0x11b0
movsd 0x6d6a(%rip), %xmm1     # 0xf110
divsd %xmm0, %xmm1
movsd %xmm1, 0x10(%rbx)
movsd 0x7141(%rip), %xmm0     # 0xf4f8
mulsd (%rsp), %xmm0
callq 0x11b0
movsd 0x6d47(%rip), %xmm1     # 0xf110
divsd %xmm0, %xmm1
movsd %xmm1, 0x18(%rbx)
movsd 0x6d5e(%rip), %xmm0     # 0xf138
mulsd (%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
movl %r15d, %r14d
movl $0x4, %r13d
xorps %xmm1, %xmm1
cvtsi2sd %r13d, %xmm1
movsd %xmm1, 0x8(%rsp)
movsd (%rsp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, 0x20(%rsp)
callq 0x11b0
movsd %xmm0, (%rbx,%r13,8)
movsd 0x20(%rsp), %xmm0
callq 0x1060
movsd %xmm0, 0x8(%rbx,%r13,8)
movsd 0x8(%rsp), %xmm0
mulsd 0x18(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
callq 0x11b0
movsd %xmm0, 0x10(%rbx,%r13,8)
movsd 0x8(%rsp), %xmm0
callq 0x1060
xorpd 0x6c37(%rip), %xmm0     # 0xf090
movlpd %xmm0, 0x18(%rbx,%r13,8)
addq $0x4, %r13
cmpq %r14, %r13
jb 0x83ee
cmpl $0x6, %ebp
movsd 0x10(%rsp), %xmm3
jb 0x8511
leaq 0x50(%rbx), %rax
xorl %ecx, %ecx
movapd 0x707a(%rip), %xmm0     # 0xf500
movl %ecx, %esi
movl %r15d, %edx
leal (%rdx,%rsi), %ecx
shrl %r15d
movq %r12, (%rbx,%rcx,8)
movsd %xmm3, 0x8(%rbx,%rcx,8)
cmpl $0x4, %r15d
jne 0x84b1
movl %esi, %esi
movupd 0x20(%rbx,%rsi,8), %xmm1
movupd %xmm1, 0x10(%rbx,%rcx,8)
jmp 0x8508
cmpl $0xa, %edx
jb 0x8508
movl %esi, %r8d
movsd 0x20(%rbx,%r8,8), %xmm1
movhpd 0x30(%rbx,%r8,8), %xmm1 # xmm1 = xmm1[0],mem[0]
movapd %xmm0, %xmm2
divpd %xmm1, %xmm2
leaq (%rbx,%rcx,8), %rsi
movupd %xmm2, 0x10(%rsi)
movl %r15d, %edi
leaq (%rax,%r8,8), %r8
movl $0x4, %r9d
movupd -0x10(%r8), %xmm1
movups (%r8), %xmm2
movupd %xmm1, (%rsi,%r9,8)
movups %xmm2, 0x10(%rsi,%r9,8)
addq $0x4, %r9
addq $0x40, %r8
cmpq %rdi, %r9
jb 0x84e5
cmpl $0x5, %edx
ja 0x8486
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq