// File: Sleepwalking[P]world-octave/synthesis.cpp
// Function: (anonymous namespace)::GetPeriodicResponse(int, double*, double*, double, InverseRealFFT*, MinimumPhaseAnalysis*, double*)
void GetPeriodicResponse(int fft_size, double *spectrum,
    double *aperiodic_ratio, double current_vuv,
    InverseRealFFT *inverse_real_fft, MinimumPhaseAnalysis *minimum_phase,
    double *periodic_response) {
  if (current_vuv <= 0.5) {
    for (int i = 0; i < fft_size; ++i) periodic_response[i] = 0.0;
    return;
  }

  for (int i = 0; i <= minimum_phase->fft_size / 2; ++i)
    minimum_phase->log_spectrum[i] =
      log(spectrum[i] * (1.0 - aperiodic_ratio[i]) +
      world::kMySafeGuardMinimum) / 2.0;
  GetMinimumPhaseSpectrum(minimum_phase);

  for (int i = 0; i <= fft_size / 2; ++i) {
    inverse_real_fft->spectrum[i][0] =
      minimum_phase->minimum_phase_spectrum[i][0];
    inverse_real_fft->spectrum[i][1] =
      minimum_phase->minimum_phase_spectrum[i][1];
  }
  fft_execute(inverse_real_fft->inverse_fft);
  fftshift(inverse_real_fft->waveform, fft_size, periodic_response);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movsd %xmm0, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
movsd 0x15f69(%rip), %xmm0    # 0x1c028
ucomisd -0x20(%rbp), %xmm0
jb 0x60f5
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0x4(%rbp), %eax
jge 0x60f0
movq -0x38(%rbp), %rax
movslq -0x3c(%rbp), %rcx
xorps %xmm0, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x60cd
jmp 0x627c
movl $0x0, -0x40(%rbp)
movl -0x40(%rbp), %eax
movl %eax, -0x94(%rbp)
movq -0x30(%rbp), %rax
movl (%rax), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0x94(%rbp), %eax
cmpl %ecx, %eax
jg 0x6181
movq -0x10(%rbp), %rax
movslq -0x40(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x18(%rbp), %rax
movslq -0x40(%rbp), %rcx
movsd 0x15ed4(%rip), %xmm1    # 0x1c010
subsd (%rax,%rcx,8), %xmm1
mulsd %xmm1, %xmm0
movsd 0x15f5b(%rip), %xmm1    # 0x1c0a8
addsd %xmm1, %xmm0
callq 0x10a0
movsd 0x15eaa(%rip), %xmm1    # 0x1c008
divsd %xmm1, %xmm0
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x40(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x60fc
movq -0x30(%rbp), %rdi
callq 0x1f90
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
movl %eax, -0x98(%rbp)
movl -0x4(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0x98(%rbp), %eax
cmpl %ecx, %eax
jg 0x621d
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x44(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movsd (%rax), %xmm0
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x44(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movsd %xmm0, (%rax)
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x44(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movsd 0x8(%rax), %xmm0
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x44(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movsd %xmm0, 0x8(%rax)
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x6191
movq -0x28(%rbp), %rsi
addq $0x18, %rsi
leaq -0x90(%rbp), %rdi
movl $0x48, %edx
callq 0x10b0
movq -0x50(%rbp), %rcx
movq %rsp, %rax
movq %rcx, 0x40(%rax)
movups -0x90(%rbp), %xmm0
movups -0x80(%rbp), %xmm1
movups -0x70(%rbp), %xmm2
movups -0x60(%rbp), %xmm3
movups %xmm3, 0x30(%rax)
movups %xmm2, 0x20(%rax)
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
callq 0xd500
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rdi
movl -0x4(%rbp), %esi
movq -0x38(%rbp), %rdx
callq 0x6710
addq $0xe0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)